I am still a newbie to html and css, seeing as I have been working with c++ and python for quite so time, and have been having trouble with the div tag. Whenever I decalre a div tag and make the background-color: black it tends to go across the screen, is there a way to make it so that the background color does not move all the way across the screen? Also I would like to know if it is possible to make the div tag's background-color automatically go all the way down the screen, thank you.

6 Years
Discussion Span
Last Post by thekitoper

There is an html attribute called "width". You can specify an element's width with this attribute.

Do a quick google search for css and you shall get along pretty good.


to make it go all the way down the screen there's a trick:

<div style="width:500px;top:0;bottom:0;margin:auto;">&nbsp;</div>

Speaking of CSS, is there a way to make to background images and align them at different sides of the page?


You can use <div></div> s to locate two images wherever you want in the page and use them as backgrounds using the position:absolute; property.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.