h1 주위에 상자를 만들고 싶습니다. 여백과 패딩을 재설정 했음에도 불구하고 여전히 위쪽과 아래쪽에 추가 공간이 생기고 있습니다.이 문제를 해결할 방법이 있습니까?
body {
margin: 0;
padding: 0;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
.hero__title {
font-size: 15.5vw;
font-weight: normal;
}
.hero__word {
display: inline-block;
position: relative;
}
.hero__block {
height: 90%;
}
.hero__block:before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 100%;
border: 1px solid black;
}
<h1 class="hero__title">
<div class="hero__word">
We
<span class="hero__block"></span>
</div>
<div class="hero__word">
Shape
<span class="hero__block"></span>
</div>
</h1>
line-height
수업 hero__word
에 추가 하여 높이를 조정할 수 있습니다 . 그런 다음 top
% 단위로 속성을 조정하여 수직 위치를 조정할 수 있습니다 .
body {
margin: 0;
padding: 0;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
.hero__title {
font-size: 15.5vw;
font-weight: normal;
}
.hero__word {
display: inline-block;
position: relative;
line-height: 95%;
}
.hero__block {
height: 90%;
}
.hero__block:before {
content: "";
position: absolute;
top: 10%;
left: 0;
right: 0;
height: 100%;
border: 1px solid black;
}
<h1 class="hero__title">
<div class="hero__word">
We
<span class="hero__block"></span>
</div>
<div class="hero__word">
Shape
<span class="hero__block"></span>
</div>
</h1>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다