Page 1 of 1
table to css
Posted: Thu Dec 30, 2004 5:37 pm
by bytte
I'm having a small problem.
I'm building my website, trying not to use any tables, in favor of CSS.
I want this script to be converted to a CSS script:
Code: Select all
<table width="650" bgcolor="#CCCCCC">
<tr>
<td align="left">Left</td>
<td align="center">Center</td>
<td align="right">Right</td>
</tr>
</table>
It's so simple. Yet I don't see a solution. Can anyone help me?
Posted: Thu Dec 30, 2004 6:53 pm
by feyd
Please use
Code: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url]
Ask and the Great Google provides.
http://glish.com/css/7.asp
http://www.pixy.cz/blogg/clanky/css-3col-layout/
the second one is probably the better one to use as example..
Posted: Fri Dec 31, 2004 4:15 am
by bytte
Thanks. But... it's not correct. My table has a fixed width. The examples only show solutions for when the contents scale with the width of the browser window.
Posted: Fri Dec 31, 2004 4:49 am
by kettle_drum
Something like:
Code: Select all
<html>
<head>
<style>
#table {
width: 650px;
}
.table-part {
float: left;
background-color: #cccccc;
width: 33%;
}
</style>
</head>
<body>
<div id="table">
<div class="table-part">
Left
</div>
<div class="table-part">
Center
</div>
<div class="table-part">
Right
</div>
</div>
</body>
</html>
Posted: Fri Dec 31, 2004 5:01 am
by bytte
Thanks a lot kettle-drum.
Now, just one more question. Can the whole thing be centered on the page?
like when you would use <table align="center">?
Posted: Fri Dec 31, 2004 5:19 am
by n00b Saibot
add following line after line 5 :
that will center the table's contents
Posted: Fri Dec 31, 2004 5:20 am
by bytte
I don't want the table's contents to be centered. I want the whole thing to be centered. So the "table" should appear horizontally in the middle of the screen.
Posted: Fri Dec 31, 2004 8:36 am
by feyd
align (hint) the div.
Posted: Fri Dec 31, 2004 11:29 pm
by n00b Saibot
I thought of telling him that but that would affect all the div's in the body. isn't it?