Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member MartyBoi's Avatar
    Join Date
    Sep 2011
    Location
    Saginaw MI
    Posts
    27
    Member #
    29177
    I had see an HTML, Body tags used in a way I never new you could do. Can someone please explain what this means?

    Code:
    html, body {
      height: 100%;
      width: 100%;
    }

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    What that is doing is defining the CSS element ( body ) ... By the way.. Every current HTML element can be defined in with CSS elements.

    What the above code is basically doing is telling the browser to use the full screen width and height for the <body> element.

    Since <body> is an HTML tag to tell the browser what to start displaying, it will be displayed at the 100% of the screen width and height.

    It's also a good practice to define your margins on this tag, even if you have none to 0 (zero) , because some browsers will add a margin of 2-3 pixels if you don't define it.

    Problem with the above if you set the height to 100%, and you content is more than 1 screen long, it won't be display properly in all browsers. A more common height attribute would be auto, so the body element will adjust bases on the content.

  4. #3
    Junior Member MartyBoi's Avatar
    Join Date
    Sep 2011
    Location
    Saginaw MI
    Posts
    27
    Member #
    29177
    Quote Originally Posted by Webzarus, post: 219519
    What that is doing is defining the CSS element ( body ) ... By the way.. Every current HTML element can be defined in with CSS elements.

    What the above code is basically doing is telling the browser to use the full screen width and height for the <body> element.

    Since <body> is an HTML tag to tell the browser what to start displaying, it will be displayed at the 100% of the screen width and height.

    It's also a good practice to define your margins on this tag, even if you have none to 0 (zero) , because some browsers will add a margin of 2-3 pixels if you don't define it.

    Problem with the above if you set the height to 100%, and you content is more than 1 screen long, it won't be display properly in all browsers. A more common height attribute would be auto, so the body element will adjust bases on the content.
    Thank you very much. You are always helpful Sir.

  5. #4
    WDF Staff m3n0tu18's Avatar
    Join Date
    Jul 2011
    Location
    Devon, UK
    Posts
    1,473
    Member #
    28473
    Liked
    265 times
    it also allows you to float a footer at the bottom of the website regardless what size screen resolution your running.
    If you like my comments to your thread please click the LIKE button

    Check out my portfolio: Here!
    View my company Facebook Page
    View my company Website

    <<Plrease ignoer my typo's I have isdexlyia>>


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:57 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com