/    Sign up×
Community /Pin to ProfileBookmark

help me make 3 columns with CSS

ok i’m a CSS NEWB. i have a site already done, but it only uses CSS for some fonts. it uses tables for the layout and one table consists of 3 columns and is HUGE, so sometimes the page loads slow. i want to break up the big table and use CSS to make the 3 columns instead.

as it is now without CSS, i have one big table centered, so the 3 columns are all always centered side-by-side. i’m having trouble replicating this with CSS.

below is someone else’s code that i’m tinkering with. column1 is on the left, column2 is in the middle, and column 3 is on the right. as of now, column2 is centered, but i can’t get column1 and column3 to stick to the sides of column2. also, i would like all 3 aligned equally at the top.

could someone please modify this code to show me how this would be done?

thanks

<style type=”text/css”>
body {
text-align:center;
width: 728px;
margin: 0px;
padding: 0px;

/* Sets Width to Maximum allowed */

div#main {
width: 728px;

}

div#column3 {

position: absolute;
width: 120px;
right: 10px;

}

div#column1 {
position: absolute;
left: 0px;
top: 100px;
width: 120px;

}

div#column2 {
width: 468px;
mmargin-left: auto; margin-right: auto;

}

</style>

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@Chaos343authorOct 31.2004 — actually, i just found this GREAT link. i probably won't need help now.

http://glish.com/css/3.asp
Copy linkTweet thisAlerts:
@JonaOct 31.2004 — <i>
</i>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;title&gt;3-Column Layout - CSS Example&lt;/title&gt;
&lt;style type="text/css"&gt;&lt;!--
body {
width: 780px;
margin: 20px auto;
}
div {
border: 1px solid #000;
}
div p {
padding: 10px;
}
#left {
width: 259px;
float: left;
}
#middle {
margin-left: -1px;
width: 258px;
float: left;
}
#right {
margin-left: -1px;
width: 259px;
float: left;
}
--&gt;&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="left"&gt;
&lt;p&gt;Fuh. Cec die qam siq ded zau yeu reo ziw qopyiv nel nonlumheg lai
puplai qam dofjii dug. Pupsep yiv yiv pupvotgig jojhoilumnuohoilumziw
xas cab kullej gig tap cab tir cid yiv bic jojjeh bue. Wes fee xas
kokvotcab yat momjojlai qen cec tap kah yiv sorxuwded xiu gig yat
quqgef wes ziw pin ran siq jii sordofzev xas zau gig qopsep sep tosver
lej sao yowtap ziw bodhaf xas zoxpupnel kij tutqoplolgae teq ver kij
woukah kokyuxded yat nim xovsiq mek yuxjag kokhuj. Rip bodnuorip ziw
dofdofyat kei jeh yeu hih wuvwoumaj cid zoxyowhih vis poomaj gig cuf.
Kah lolkokdug. Fogjii jojsorroqlum.&lt;/p&gt;
&lt;/div&gt;
&lt;div id="middle"&gt;
&lt;p&gt;Ver dac yuxvaq mil xuwjukfif pin cid ded die ziw cuf. Dofsao pem
dofxet pal votjeh siq votjag wes ded kah lumteq lej vis nim munhoixiu
nim lumjeh bodkei wuvtuttir lollik roqfif mil pupdofdie lej xuwkij jag
woujeh vuuvotyowzau kulfuh. Yowkei bue. Dug. Xuwxet pal rurzau fogteq
suscid poogef fad fee lumsorxuwfuh. Reo dac hih sao jag fad jag beb jii
hih ded nuololcab zev cid bic huj. Mil munxas bic lej coefif xovzuyqio
ran gui. Lai ran suscid rip jag tutpin zau gig bodwes jii jag fogvaq
siq dofgef sao zoxlej roqhih ded quqyeu nuoquqpal tap quqfad kei roqbaa
siq jukhoicec wourip dug. Nongef qam nim poopal hih cuf. Xuwhuj. Cuf.
Fogxiu kij beb heg roqfogqam kulvotxiu sorxet reo loljukhih kij lej
coebic roqtoscoecec ziw lik gef tir qoplej jukbic wuvfif poogig
susmomcoemunyeu cuf. Rurfoghih yat xet qam ran bodpin reo
coenonmuntosquqbeb quqjojfad tosfad rip pal teq maj mek sao bodboddac
cec lolzau xas tir yeu qam tospem dug. Pal zev.&lt;/p&gt;
&lt;/div&gt;
&lt;div id="right"&gt;
&lt;p&gt;Nel dofhuj. Munziw nel nel nim wes jeh rurdug. Rip xovded nuocuf.
Yuxjii lai kah lumhih tir nak rip jii baa lumkulqio jeh jeh jii lai mil
sordac teq jag zoxpal roqjukran nuocuf. Xiu baa roqxovsusvaq vuucec siq
lolfoglumgohsoryeu fee reo haf gui. Huj. Rurrip fogpin lik hih
lollumkah pupxet poojii baa cid jojrip zuygae nonwit xas rip tap nim
fad munqam cab xet baa fee kij tir jojcab sorjojhoiqio pupheg dug. Qen
cid huj. Beb tap kei zoxziw reo lai poorurnuozau hih nel zau war gef
toshaf gui. Sep qam ziw gohwes maj huj. Quqlik huj. Dac qoppoolik mek
votnak xovlumwes hoizev xiu dac juktostosbic yowwes mil pem wou.&lt;/p&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@LarzmanNov 01.2004 — I have been searching this forum and reading alistapart and others, but I still cannot get my 3-column layout to display properly. The columns all appear, but the white background only gets displayed as long is there is content in the <div>, which means that the columns are not equal length. I am using a body background color (green) and the column backgrounds need to all be white, and stretch the full length of the page. IE is actually displaying it the way I like, but no one really uses that piece of crap browser, do they?!? (and I feel sorry for those that do. Just what I want, browser hijackers, malware and other "fun" stuff!)
Copy linkTweet thisAlerts:
@toicontienNov 01.2004 — [i]Originally posted by Larzman [/i]

[B]I am using a body background color (green) and the column backgrounds need to all be white, and stretch the full length of the page.[/B][/QUOTE]

You'll be interested in [url=http://www.alistapart.com/articles/fauxcolumns/]Faux Columns[/url] at [url=http://www.alistapart.com/]A List Apart[/url]. If you still want some assistance, post another topic in this forum.

[i]Originally posted by Larzman [/i]

[B]IE is actually displaying it the way I like, but no one really uses that piece of crap browser, do they?!?[/B][/QUOTE]

? *sigh* If only that were true... [url=http://www.thecounter.com/stats/2004/September/browser.php]September 2004 browser usage stats[/url]
Copy linkTweet thisAlerts:
@Ben_RogersNov 01.2004 — [i]Originally posted by Larzman [/i]

[B]IE is actually displaying it the way I like,[/B][/QUOTE]
It may be the way you like, but IE is displaying it incorrectly. Trust me on that one.
Copy linkTweet thisAlerts:
@LarzmanNov 02.2004 — I know IE sux, but I have to test for it also on my company website - unfortunately! I've heard that before, page displays only well in IE, that's because IE is broken.

Would you like me to post the page & CSS I'm using?
×

Success!

Help @Chaos343 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.22,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...