开发者

How do I get a div to occupy 90% of the width of any size of monitor?

What is the css for a div which occupie开发者_JAVA技巧s 90% of the screen in any size of monitor?


Er...

div { width: 90%; }

or

div { margin: 0 5%; }


.myClass{
  width: 90%;
}

<div class="myClass"></div>


<head>
    <style type="text/css">
    .myClass{
        width: 90%;
    }
    </style>
</head>
<body>
    <!-- ... -->
    <div class="myClass"></div>
    <!-- ... -->
</body>

Or,

<div style="width: 90%;"></div>

But dude, seriously, check out the W3C's CSS2 reference manual and at least try to find the answer by yourself.


div { position:absolute; left:5%; right:5% }

Test and see...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜