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 6 of 6
  1. #1
    New Coder
    Join Date
    Dec 2006
    Location
    Bahrain
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS div question

    Hey my "overflow" scroll has problems. This is just my trial template(idk lol) It has the scrollbar, but when there are a lot of text, them, the div's, expand.
    Code:
    <html>
    <head>
    <style>
    body {background-color: black;}
    h1,h2,h3,h4,h5,h6 {color: white}
    th{background-color:#a52a2a;font-family:verdana;font-size:29px;border-color:white;border-style:  solid; border-width: 1px; border-bottom-color: #ccffcc;border-top-color:black}
    div.1
    {
    overflow: scroll;
    background-color:indigo;
    border-style: inset;
    width="8cm"
    }
    </style>
    </head>
    <body>
    <table align="center">
    <tr>
    <th colspan="250">Page title<hr width="275" color="white"><h6>Page description</h6></th>
    </tr>
    </table>
    <hr color="white" onmouseover="style=color='#ccffcc'" onmouseout="style=color='white'"><br><div class=1><h6>Current news here. Current news here. Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.Current news here.Current news here. Current news here. Current news here.</h6></div>
    </body>
    </html>
    ALWAYS remember to validate your code

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Your page doesn't have a doctype, and fails validation.

    If it doesn't validate, it is very hard to debug.

    Try fixing those problems first, and see what you have.

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New Coder
    Join Date
    Dec 2006
    Location
    Bahrain
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, what doctype?
    ALWAYS remember to validate your code

  • #4
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Well, HTML 4 should be fine, but if you're up a little more work, I'd recommend XHTML 1.0 Strict

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #5
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,338
    Thanks
    29
    Thanked 282 Times in 276 Posts
    The overflow property does nothing for an element that does not have assigned dimensions. If you want the element to have a scroll‐bar appear when its content overflows a certain width or height, you must first assign the element a width or height as the threshold for the overflow.

    Errors:
    • The document type declaration is missing (already mentioned).
    • The head element is missing the required title element.
    • The style element is missing the required type attribute.
    • “width="8cm"” is not a valid CSS declaration.
    • You’ve set a colspan attribute value of “250” when the table only has one column.
    • The hr element doesn’t have a “color” attribute.
    • “style=color='#ccffcc'” and “style=color='white'” are not valid JavaScript. That code should most likely be written as this.style.color = '#cfc'; and this.style.color = 'white';.

    Other issues:
    • Declare a generic font family in case the user doesn’t have the listed fonts. Example: font-family: Verdana, sans-serif;.
    • You can condense related CSS properties:
      • Example: font: bold 29px Verdana, sans-serif;.
      • Example: border: 1px solid white;.
    • You can condense hexidecimal color values. For example, #ccffcc and #cfc are equivalent.
    • Use the modern form of the align attribute (on a table element): the CSS margin: 0 auto declaration. Note: doesn’t work in Internet Explorer without a document type declaration.
    • Use the modern form of the width attribute: the CSS width property.
    • Use the modern form of the color attribute: the CSS color property.
    • Using tables for layout is not semantic.
    • Using an h6 element without also preceding that element by the h1, h2, h3, h4, and h5 elements is not semantic.
    • Putting content other than a header inside the six header elements is not semantic.
    • Use CSS instead of the br element to create white‐space.
    • Surround all attribute values with double quotes for consistency. While not required in HTML, it’s good practice. They are required in XHTML.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #6
    New Coder
    Join Date
    Dec 2006
    Location
    Bahrain
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok ty's
    ALWAYS remember to validate your code


  •  

    Posting Permissions

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