登录 | 注册 | FAQ
Anonymous

why

+ 发表回复

2 篇帖子 分页: 1 / 1


why

nada » 周六 11月 27, 2010 3:59 pm

<html>
<head>
<style type="text/css">
p { background-color:green; }
h1 { background-color:blue; }
div { background-color:red; }
</style>
</head>

<body>
<div>
<h1> h1 blue </h1>
<p> p green </p>
</div>
</body>

</html>

the run is attached , the questions:
* why the red color appear in the middle only ?
* why not the red color appear from the four sides ?
What is the rule applied ?

Than you very much

附件

  1. example.png (2.22 KiB) 被下载 3045 次
    run

头像

nada

  • 帖子: 3
  • 注册: 周四 11月 18, 2010 8:39 pm

Re: why

HTML.net » 周六 11月 27, 2010 5:24 pm

You need to set the height and width of the div:

div { background-color:red;height:100%; width:100% }

Or set the background-color on the body:

body { background-color:red }


- Andreas, HTML.net
头像

HTML.net
Site Admin

  • 帖子: 1194
  • 注册: 周六 9月 11, 2010 11:24 am
--
Show some love for HTML.net on Twitter, Facebook and Google: Use the buttons on top of all pages.


+ 发表回复

分页: 1 / 1