Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help with <DIV>

Options
  • 23-11-2007 10:20am
    #1
    Registered Users Posts: 413 ✭✭


    Hi,
    Has anybody got and ideas on how to deal with firefox inserting linebreaks after div tags an IE not?

    I have a banner/image in a top div tag with a menu underneath. FF has a line break after the top image before the menu, but IE doesn't.
    I've tried various options: having them in the one division, minus padding and margins. But the menu gets messed up...
    any ideas?
    <div id="bannerM">
    	<img src="images/bannerYoga.jpg" height="132" width="871" alt="Yoga at Beyond Harmony" />
    </div>
    <div id="menu">
           <ul>
    	menu.......
           </ul>
    </div>
    


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Do you have CSS attached to those IDs?


  • Registered Users Posts: 11,987 ✭✭✭✭zAbbo


    #bannerM img{ border: none; padding:0; margin:0}
    
    ?


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    I think a div is an block-level element by default, so will typically put a carriage return in automatically.

    try:
    [html]
    <div style="display: inline">
    [/html]


  • Registered Users Posts: 413 ✭✭ianhobo


    Do you have CSS attached to those IDs?

    sorry......
    #bannerM
    {
    	margin: auto;
    	width: 871px;
    	height: 132px;
    	border-bottom:none;
    	/*background-image:url(images/bannerM.jpg);*/
    }
    
    #menu
    {
         font-family:Verdana, Arial, Helvetica, sans-serif;
         color:#FFFFFF;
         margin:auto;
         width: 871px;
         height: 2.25em;
         background-color: #FAA619;
         border-bottom:none;
    }
    


  • Registered Users Posts: 413 ✭✭ianhobo


    eoin_s wrote: »
    I think a div is an block-level element by default, so will typically put a carriage return in automatically.

    try:
    [html]
    <div style="display: inline">
    [/html]

    Correct, but I have used "margin: auto" to centre the image, so adding an inline display style pushes it back over to the left, and there is still a line break.
    #bannerM img{ border: none; padding:0; margin:0}
    

    Unfortunately this doesn't work either.

    If i use the inline display on the menu div, it all get corrupted.....


  • Advertisement
  • Registered Users Posts: 3,594 ✭✭✭forbairt


    try throwing a margin:0 padding:0 into your bannerM class you have it for the image but not for the div#bannerM

    If you throw it up on a page it'll be solved in seconds for you I'd say

    Edit: its possible your menu has a margin at the top which is going outside its container and pushing things down.


  • Registered Users Posts: 413 ✭✭ianhobo


    http://www.beyondharmony.ie/new/yoga.html

    Its still a work in progress, so the style sheet has lots of stuff commented out, its hasn't been checked for validation, and i'm sure there are a few other "issues" :D
    Its my first real go a completely table-less site and its this one cross browser issue thats causing me the most headache.


  • Registered Users Posts: 413 ✭✭ianhobo


    forbairt wrote: »
    try throwing a margin:0 padding:0 into your bannerM class you have it for the image but not for the div#bannerM

    If you throw it up on a page it'll be solved in seconds for you I'd say

    Edit: its possible your menu has a margin at the top which is going outside its container and pushing things down.

    The menu has no declared margins, and I added "margin:0; padding:0" to both the style sheet calss, and to the local page image tag, no effect :(


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    #menu ul { margin:0; } should do the job for you .. enjoy


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    BTW ... dump all your div's into a lets call it container div with margins auto ... and this means you don't have to keep defining auto margins for each element


  • Advertisement
  • Registered Users Posts: 413 ✭✭ianhobo


    forbairt wrote: »
    #menu ul { margin:0; } should do the job for you .. enjoy

    wohoo! :D

    That did fix that problem, but it un-centers the menu then in IE pushing at all left ha ha


  • Registered Users Posts: 413 ✭✭ianhobo


    #menu ul 
    { 	
    	margin-top:0;
    	margin-bottom:0;
    }
    

    Got it :D
    thanks for all your help and ideas

    Hopefully will get it finished and tidied by the weekend!


  • Registered Users Posts: 413 ✭✭ianhobo


    forbairt wrote: »
    BTW ... dump all your div's into a lets call it container div with margins auto ... and this means you don't have to keep defining auto margins for each element

    ok, cool. Thanks for that


Advertisement