Jump to content

CSS3 Columns


Recommended Posts

I am having trouble keeping my content within the divs or sorted in column. They seem to be ever expanding.

 

I have tried have 3 divs with each set 400px each set to float within a 1200px container. and thought this would contain them but they appear in one line. Also tried using the css3 columns but that is also doing the same thing. I have no idea where i went wrong?

 

This is the HTML

<!DOCTYPE html><head><html><title>Untitled Document</title><link href="mainstylesheet.css" rel="stylesheet" type="text/css" /><link href="textcss.css" rel="stylesheet" type="text/css"><link href="infotray.css" rel="stylesheet" type="text/css"><meta charset="utf-8"></head><body><div class="wrapper"><div class="header"><div class="headeropacity"></div><div id="navbar"><ul id="nav"><li><a href="#DKSND.asp">HOME</a></li><li><a href="#news.asp">NEWS</a></li><li><a href="#about.asp">COURSES</a></li><li><a href="#about.asp">ABOUT US</a></li><div id="pointer"></div></ul> </div></div><div class="content1">  <h2>Heading</h2>  <p>wjkdnsidn </p>  <p> </p>  <p> </p>  <p> </p>  <p> </p>  <p> </p></div><div class="content2">  <h2>Heading</h2><div class="rollinfotray"><div class="infobox1"></div><div class="infobox2">	</div><div class="infobox3"></div><div class="infobox1"></div></div></div><div class="content3"><div class="contentcontainer"><div class="left"> <h2>Heading</h2> 	Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus  <p> </p>  <p> </p>  <p> </p>  <p> </p>  <p> </p>  <p> </p></div><div class="middle"> <h2>Heading</h2>   	Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.</div><div class="right"> <h2>Heading</h2>   	Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.</div>   </div></div><div class="footer">  <h2>Footerlinks</h2>  <p> </p>  <div class="contentcontainer"><p class="three-col">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>  <p> </p>  <p> </p>  <p> </p>  <p> </p>  </div></div></div></body></html>

And related CSS

@charset "utf-8";@import url("navigationcss.css");html, body  {    margin: 0;    padding: 0;	white-space: nowrap;}.header,.content1,.content2,.content3,.footer{	float: left;		width: 100%;	text-align:center;	line-height:130%;	overflow:hidden;	}.contentcontainer{	width: 1200px;	margin-right: auto;	margin-bottom: auto;	}.left,.middle,.right{width:400px;float:left;}.wrapper {	height: 100%;	width: 100%;}.header { }.content1 {}.content2 {	background-color: #222;}.content3 {	background-color: #999;	}.footer {	background-color: #CCC;}
@charset "utf-8";h2 {	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;	font-size: 20pt;	color: navy;	padding-top: 12px;	padding-bottom: 3px;	opacity:2;}.three-col {       -moz-column-count: 3;       -moz-column-gap: 20px;       -webkit-column-count: 3;       -webkit-column-gap: 20px;}
Link to post
Share on other sites

Here's an idea.... when something doesn't work, stop writing.

 

Go back to a simple example and get a simple version to work.

 

You can see that this simple example works...

 

http://www.w3schools.com/css/tryit.asp?filename=trycss3_column-count

 

...and you can see that this simple example works...

 

http://www.w3schools.com/css/tryit.asp?filename=trycss_float6

 

...so that means that your code is full of errors. And where to even begin... you have an error on line two.

Edited by davej
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...