Jump to content

Tetris Style Div's


Takararyuu

Recommended Posts

Hi there!

 

I was just wondering, there is a theme named 'Tetris' for wordpress. (Link) When posts are placed they float to the left and line up to the top neatly.

 

Well currently i am creating a wordpress based website, and on the pages i use '#homediv' to id the div's that i want to do the same. Problem with how i coded it: they do float left, but do not line up to the top...

 

I tried to search the code of 'Tetris' how they manage to do it, but couln't figure it out. If you know how to make this happen please tell me (and the others that search for the same problem on Google and land here).

 

 

Code as it is now:

/*CSS OF HOMEDIV:*/	#homediv {		width:45%;		min-width:180px;		float: inherit;		border:solid 1px #7D1517 ;		margin:1%;		border-bottom-left-radius:10px;		-moz-border-bottom-left-radius:10px;		-o-border-bottom-left-radius:10px;		-webkit-border-bottom-left-radius:10px;		border-bottom-right-radius:10px;		-moz-border-bottom-right-radius:10px;		-o-border-bottom-right-radius:10px;		-webkit-border-bottom-right-radius:10px;		padding-bottom:15px;	}		#homediv h5 {			text-align:center;			background:#7D1517;			color:#FFF;		}		#homediv h6 {			margin-left:3%;			margin-right:2%;		}		#homediv p {			margin-left:2%;			margin-right:2%;		}

Image example:

 

Example.png

As you see, they do not line up to top.

 

Thanks in advance!

- Marcel

Link to comment
Share on other sites

I'm not sure what you, by that they don't line up up top? Are you talking about want the "Geen slaging.." box to be right below the the bottom of the box above it, without the space?

Edited by thescientist
Link to comment
Share on other sites

I'm not sure what you, by that they don't line up up top? Are you talking about want the "Geen slaging.." box to be right below the the bottom of the box above it, without the space?

 

Sorry, yes that is what i intend to make. No white spaces in between like in the 'Tetris' theme.

 

EDIT: Life example

Edited by Takararyuu
Link to comment
Share on other sites

Just make two columns, and put the rest of the boxes inside:

<div id="columnA">    <div class="box">Box</div>    <div class="box">Box</div>    <div class="box">Box</div>    <div class="box">Box</div></div><div id="columnB">    <div class="box">Box</div>    <div class="box">Box</div>    <div class="box">Box</div>    <div class="box">Box</div></div>
#columnA {    width: 50%;    float: left;    padding: 1px 0; /* Prevent collapsing margins */}#columnB {    margin-left: 50%;    padding: 1px 0; /* Prevent collapsing margins */}.box {    border: 1px solid red;    border-radius: 10px;    -moz-border-radius: 10px;    margin: 5px 10px;}
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...