+ 4
I want to have a background image in the div tag that doesn't go to the next line. How do i fix it? Code is in the description.
<!doctype html> <head> <title>page</title> </head> <body> <div style="background-image: url('pic.gif);"> </body> </html>
5 ответов
+ 3
I know the div tag automatically goes to the next line because its a block tag. But how do I start the div from the beginning of the page without having the white space that I have with this code.
+ 3
thanks. I write body{ margin: 0;} and it works. But, is the HTML{ margin: 0; padding: 0} necessary ?
+ 3
nope, but it's just my habit to write that^^
+ 3
why do you have that habit
+ 2
I don't know if I've clearly got your prob, but I guess you're talking about that padding that the browser puts by default in your page. to fix this you'll have to use some CSS.
html, body{ padding :0; margin:0;}
Also, divs can be changed so as they can be aligned at a line level while "behaving" as a block at the same time. Just apply display: inline-block; to those divs