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

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.

  • Create New...