我想成为“黑人”的div。在调整浏览器大小时,它没有调整大小
如何制作不调整浏览器大小的DIV调整大小? 该代码的div如下,还有其他7个类与紫色相同,但我希望黑色不与浏览器调整大小,我可以寻找什么可能的步骤
<div class="BLACK">
<P>THIS IS BLACK DIV AND IT WILL NOT RESIZE WITH
BROWSER</P>
</div>
<div class="PURPLE">
<p>THIS IS PURPLE DIV AND IT WILL RESIZE WITH BROWSER</p>
</div>
.BLACK
{
background-color: black;
background-size: contain;
background-size: cover;
font-size: fixed;
height:20%;
width:20%;
display: block;
margin-right: 30%;
margin-top: 1%;
padding-top: 9%;
padding-bottom: 8%;
}
.PURPLE
{
background-color: purple;
height: 7%;
padding-top: 0.05%;
padding-bottom: 0.05%;
margin-left: 20%;
text-align: center;
}
how to make a div which do not resize with browser resize?
div for that code is as below there are other 7 classes same as purple but I want BLACK not to resize with browser what are possible steps I can look for
<div class="BLACK">
<P>THIS IS BLACK DIV AND IT WILL NOT RESIZE WITH
BROWSER</P>
</div>
<div class="PURPLE">
<p>THIS IS PURPLE DIV AND IT WILL RESIZE WITH BROWSER</p>
</div>
.BLACK
{
background-color: black;
background-size: contain;
background-size: cover;
font-size: fixed;
height:20%;
width:20%;
display: block;
margin-right: 30%;
margin-top: 1%;
padding-top: 9%;
padding-bottom: 8%;
}
.PURPLE
{
background-color: purple;
height: 7%;
padding-top: 0.05%;
padding-bottom: 0.05%;
margin-left: 20%;
text-align: center;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
div
可以使用px单元固定大小,例如width:20px;
或width:300px;
div
size can be fixed using px unit likewidth:20px;
orwidth:300px;