Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    SMC
    SMC is offline
    New Coder
    Join Date
    Jun 2007
    Location
    Orlando, FL
    Posts
    60
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Div layers not quite squeezing together

    Hello everyone,

    Heres the problem:



    As you can see the div layers aren't quite squeezing together. Here is the related code:

    Code:
    <div id="content-left">
    	<div style="margin-bottom: 0px;"><img src="/images/news_bar.jpg" alt="News" /></div>
    	<div class="news-block">Test</div>
    </div>
    Code:
    /* Home page CSS Stylesheet */
    
    /* Div Classes */
    
    .news-block {
    
    	border: 1px solid #bc6401;
    	border-top: 0px;
    	padding: 5px;
    	width: 488px;
    	height: 100%;
    	
    	margin-top: 0px;
    	
    }
    As you can see I've tried margin: 0px; but it doesn't seem to have had an affect.

    Ideas?

  • #2
    Regular Coder BWiz's Avatar
    Join Date
    Mar 2006
    Location
    Sol System
    Posts
    471
    Thanks
    7
    Thanked 21 Times in 21 Posts
    You have to float your <div>s if you wan't them t be side by side. That, or set your display attribute to inline.

    Float:
    Code:
    <style type="text/css">
    div { float: left; }
    </style>
    Display:inline;
    Code:
    <style type="text/css">
    div { display: inline; }
    </style>
    Note: Set id's
    BWiz :: Happy Coding!
    2006
    2007 2008 2009
    2010 2011
    Irrational numbers make no sense.

  • #3
    SMC
    SMC is offline
    New Coder
    Join Date
    Jun 2007
    Location
    Orlando, FL
    Posts
    60
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Perhaps I didn't make myself clear enough, I'm trying to get the tiny space above between the 'News' block and the 3 bordered div section gone. Just to be on the safe side, I tried your suggestions but neitheir worked (infact inline had the opposite effect).

    Any suggestions on how to achieve the elimination of that tiny space?

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,665
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    What happens if you made your image inside that div display: block;?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •