Answer the question
In order to leave comments, you need to log in
How to set border width as a percentage?
There is a rubber block whose height is not specified. How to set the width of the top and bottom borders as a percentage?
Answer the question
In order to leave comments, you need to log in
No way. You can replace the border with before and after pseudo-elements and set the height as a percentage for them. But without specific code, it's hard to offer something more specific.
Hmm, it's interesting to me, why do you need this perversion... and maybe box-sizing: border-box; ?
Such a solution would help to make the relative width in a dynamically resizable window, that is, without page updates, but adaptively, but without javascript. Unfortunately there is no solution, the percentage cannot be set to the border.
BUT, there are values that are taken into account in the border....strangely enough, these are vh and vw ))))
The only problem is, these values completely ignore the scrollbar.
Here's what I got:
.home .top-banner .ban-for-mob:after {
content: '';
display: block;
position: absolute;
border-left: 50vw solid transparent;
border-right: 50vw solid transparent;
border-top: 50px solid #231f20;
border-bottom: 0;
top: 100%;
left: 50%;
margin-left: -50vw;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question