www.webdeveloper.com
Results 1 to 4 of 4

Thread: what is the purpose of html { .... in a stylesheet

  1. #1
    Join Date
    Mar 2010
    Posts
    281

    what is the purpose of html { .... in a stylesheet

    am studying some code from a pretty good website and came across this tag...

    html {
    overflow-y: scroll;
    }


    this site uses some parallax animation and maybe has something to do with that.
    but why would you even have a style rule for HTML.

    is that a master container?

  2. #2
    Join Date
    Mar 2011
    Posts
    1,136
    CSS rules are generally applied to the <html> tag to initialize them and to set rules that will be inherited throughout the document. Initializing a document using the <html> tag insures that the browser doesn't have an unexpected default setting for that element that would impact the layout, so its a common practice.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Mar 2010
    Posts
    281
    belated thanks, for answering my post

  4. #4
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    Rick said it best, but I'm just chiming in a bit. If you set your font in html {}, then everything cascading down from there, which is everything in the doc, has that same font applied. Personally, when I set my defaults for my doc, I do:

    html, body {
    blah: blah
    }

    Setting both the html and body.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles