开发者

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

开发者 https://www.devze.com 2022-12-29 22:02 出处:网络
What is the css for a div which occupie开发者_JAVA技巧s 90% of the screen in any size of monitor?Er...

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

精彩评论

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

关注公众号