Jump to content
Sign in to follow this  
imironchik

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?

Share this post


Link to post
Share on other sites

You can use margins to add more separation between elements.

Share this post


Link to post
Share on other sites

Where is the CSS for item1 & item2? Using margin top | bottom should fix that, except there is/are ERROR(s) in you® CSS.

Edited by CodeName

Share this post


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;}

Share this post


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...
Sign in to follow this  

×
×
  • Create New...