Jump to content

Recommended Posts

Hi guys,

i have this question if i write:

body {background-color:blue;height:200px;width:200px}

i see all blue because also html will be blue.

Instead with border it works:

body {border:2px solid black;height:200px;width:200px}

Who can explain me the reason for the background?

Link to post
Share on other sites

The body height by default is set to content within it. If the html element has no background-color set it takes on the colour of the body. So the body is continues to behave as default, but is hidden by html element background colour, until exposed by adding a styling  such as a border to body as you did, or adding background colour to html element.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...