我創建了一個模板,其中我使用了一個模板,其中僞類嘗試進行分組功能,但是當我更改屏幕大小時它正在變成像素,您可以在此問題中幫助我解決問題。我將顯示圖像應該如何來看待創建一個具有html特性分組的模板
唯一的問題是在responsivness
小提琴:https://jsfiddle.net/t93v93cn/
代碼如下
HTML
<div class="grouping-container">
<span class="groupBadge"><h4>Group1</h4></span>
<div class="headingContainer">
<h1>Heading 1</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's</p>
</div>
<div class="heading-container">
<h1>Heading 2</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
CSS
.grouping-container{
position:relative;
width:100%;
max-width: 70%;
margin: 30px auto;
padding: 15px 15px 50px 15px;
box-sizing: border-box;
background: #ccc;
}
.headingContainer,.heading-container{
width: 90%;
max-width: 85%;
margin: 5px auto;
background: rgba(35, 122, 197, 0.4);
padding: 5px 25px 50px 25px
}
.headingContainer p,.heading-container p{
font-size: 25px;
}
.headingContainer:before{
content: "";
border-top: 1px solid red;
padding: 0 25px;
position: absolute;
left: 34px;
margin-top: -6px;
}
.heading-container:before{
content: "";
border-bottom: 1px solid red;
padding: 0 24px;
position: absolute;
left: 33px;
bottom: 55px;
}
.groupBadge{
width: 108px;
height: 30px;
padding: 18px 120px;
display: inline-block;
background: #7ecaca;
transform: rotate(90deg);
position: absolute;
bottom: 43%;
left: -217px;
}
.groupBadge:before{
content: "";
position: absolute;
padding: 5px 105px;
border-top: 1px solid red;
left: 100%;
}
.groupBadge:after{
content: "";
position: absolute;
padding: 5px 105px;
color: red;
border-top: 1px solid red;
right: 100%;
bottom: 7px;
}
.groupBadge h4{
margin-top: -10px;
transform: rotate(180deg);
padding-right: 36px;
}
相反PX使用EM的,默認情況下,比16像素到1EM – zer00ne
@ zer00ne有你很難關於HTML分組。如果你不介意,你可以請更新小提琴 –
不,分組聽起來不像是與HTML或CSS AFAIK特別相關的任何東西。代碼太多是將px轉換爲em的冗餘而簡單的任務。如果有px測量值,則將該數字除以16. – zer00ne