Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Div box problem

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34987
    djpic
    Participant

    I need help with a div block problem.

    I want it to look like this:
    Correct Layout

    But instead, it displays like this:
    How it appears

    Here is the HTML code:



    Upcoming City Holidays


    Christmas
    Sunday, Decemeber 25th


    Thanksgiving
    Wednesday, Decemeber 25th




    Annoucements



    New City Policy
    By: John Doe


    New City Policy
    By: John Doe


    New City Policy
    By: John Doe


    New City Policy
    By: John Doe


    New City Policy
    By: John Doe




    This is the Style Sheet:


    #holidays, #announcements {
    float: left;
    width: 200px;
    border: 1px solid #000;
    padding: 0px;
    text-align: center;
    margin-right: 5px;
    height: 150px;
    overflow: hidden;
    }
    #holidays h3, #announcements h3 {
    background-color: #006;
    display: block;
    color: #FFF;
    text-align: center;
    padding-top: 2px;
    padding-bottom: 2px;
    font-size: 14px;
    margin-bottom: 20px;
    }
    #announcements {
    margin-right: 0px;
    text-align: left;
    width: 471px;
    }
    #announcements div {
    overflow: scroll;
    overflow-style: marquee-line;
    height: 100%;
    }
    #announcements h3 {
    margin-bottom: 0px;
    }
    #announcements h4 {
    margin-top: 10px;
    margin-bottom: 10px;
    margin-left: 10px;
    font-size: 14px;
    }
    #announcements span {
    font-style: italic;
    font-weight: normal;
    font-size: 12px;
    }
    #holidays p {
    padding: 0px;
    font-size: 12px;
    margin-top: 0px;
    font-style: italic;
    }
    #holidays span {
    font-weight: bold;
    font-style: normal;
    }
    #Content {
    width: 680px;
    padding-left: 60px;
    padding-right: 60px;
    padding-bottom: 5px;
    padding-top: 0px;
    background-image: url(../../layout/content_background.jpg);
    clear: both;
    margin-top: 0px;
    margin-right: auto;
    margin-bottom: 0px;
    margin-left: auto;
    }

    #89978
    takeiteasy04
    Member

    Try adding this…

    …just above the closing tag of the “#Content” div.

    #89981
    djpic
    Participant

    Looks like the overflow: hidden worked but why?

    The other problem I have now is the h3 tag is not flush to the containing div tag.
    h3 no flush

    #89982
    djpic
    Participant

    Never-mind, I figured it out. I needed to add a “marign-top: 0px” for the h3 tags. I believe it was because the box had no boundary to push against. Still curious why overflow: hidden worked though.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.