【发布时间】:2021-01-26 00:19:59
【问题描述】:
我是 CSS 新手,一周半前开始接触 CSS,我遇到了一个很难解决的问题。我需要我的网页来查看 Like this,我尝试了很多东西,但我还没有找到解决方案。看起来不太对,看起来不像50%-50%
<body>
<header class= "header">
<div class="box-1">
<h1>TOP STUDENTS</h1>
<b>Historic best averages</b>
</div>
</header>
/*Now to CSS*/
.header{
display: inline-block;
top:2vw;
left:2vh;
width:50vh;
right:2vh;
height:5vh;
margin:5% 25%;
position:relative;
}
.box-1{
min-width:400px;
min-height:60px;
padding-top:5px;
padding-bottom:5px;
text-align:center;
box-sizing:border-box;
border: 4px rgba(24, 26, 1, 0.705) solid;
font-size:24px;
display:inline-block;
background-color: rgba(200, 220, 150, 0.7);
box-shadow: inset 0 0 15px rgba(0,0,0,.5);
}
.box-1:hover{
width:400px;
height:110%;
font-size:30px;
background-color:rgba(226, 208, 40, 0.822);
transition: 2s;
}
我有两台分辨率不同的显示器,当我交换页面时,它会自行破坏,但目标并没有纠正这一点,因为这不是练习所要求的。 我已经在这里尝试了一些建议的解决方案,但似乎没有任何效果。我显然做错了什么 enter image description here 在我开始纠正它并使页眉看起来像它应该的样子(橙色是页眉)之前,该页面做得很好,但它是不正确的。 谢谢 非常重要的说明:我不能使用 flexbox,因为练习明确告诉我不要。
【问题讨论】:
标签: html css header block margin