+ Reply to Thread
Results 1 to 9 of 9

Thread: CSS Error =[

  1. #1
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    CSS Error =[

    Why does this page's elements not center when a width is defined? I am sure I am missing some small detail. Images are just placeholders. Thanks for any help.

  2. #2
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: CSS Error =[

    Code:
    * {
       margin: 0 auto;
    }
    that should center the body

  3. #3
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: CSS Error =[

    The inline content is centered; it's centered relative to its left and right sides, which depend on the parent element. By setting a width on <body>, you've restricted the left and right sides of its descendants. If you center the body (e.g. by setting margin to "auto" for modern browsers), everything centered within <body> will be appear centered relative to the viewport.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  4. #4
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: CSS Error =[

    Thanks misson, that did the trick =]

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: CSS Error =[

    Don't count out Diablo's suggestion. It will center block elements with explicit widths, whereas using text-align won't.

    The #menu definition list as used is non-semantic. An <ul> or <ol> would be better.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  6. #6
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: CSS Error =[

    Well yes, but I plan to use the different elements in the definition list to distinguish between menu and sub menu items.

  7. #7
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: CSS Error =[

    Are you implementing an accordion menu?
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  8. #8
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: CSS Error =[

    No, just a difference in style. It is like a drop down menu, except already dropped down.

    Code:
    dl dt {
    font-size: 100px;
    color: pink
    }
    
    dl dd {
    font-size: 9px;
    color: black
    }
    Last edited by Twinkie; 09-22-2009 at 06:35 AM.

  9. #9
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: CSS Error =[

    Looks like list abuse; <dt> denotes a term and <dd> it's definition. Any other use is non-semantic and means programs (such as search engine spiders) can't deduce as much information, or will deduce the wrong information. Better to use an unordered list and a class for whichever list items are the exceptions.

    Also, using "px" for font sizes doesn't scale well with monitor resolution.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers