Jump to content

Distance between two <div> tags in a container


Recommended Posts

Hello. Can anybody explain me how can I set distance between two <div> in a container? Look at the example:

<div id="container">  <div id="item1"></div>  <div id="item2"></div></div>

I need a distance between item1 and item2. I've already played with top, bottom, margin, but nothing help me. Then how?

Link to comment
Share on other sites

I suggest :

<div id="container">  <div id="item1" class="container-item"></div>  <div id="item2" class="container-item"></div></div>

and your css is :

#container .container-item {   display: block;   margin: 5px 0;}

Link to comment
Share on other sites

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...