I want to create a rectangle with empty span, but width and height are ignored.
html code
<h1 class="intro-titel intro-titel-spiciy">
PRORERTY
<span class="span"></span>
</h1>
css code
.intro-titel{
font-size: 80px;
font-weight: 750;
color: #fff;
}
.intro-titel-spiciy{
background-color: #FFB703;
color: black;
font-size: 87px;
}
.span{
width: 50px;
height: 100%;
background-color: #fff;
border: 1px solid black;
}
According to the things I searched, I expected it to be fixed by adding the following items
first attempt
.span{
display:block;
/* and I try display:inline-block; but it dosen't work*/
/* other styles */
}
second attempt
span.product__specfield_8_arrow{
display: inline-block;
}
but none of them didn’t work.
2
Answers
You can make 2 changes:
height
to.intro-titel
like this:display
to.span
like this:Which should work now.
Applying
width
&height
to aspan
is troublesome. Generally what I do is don’t use span tag instead use normal div add respective class to it and it works fine in your code too. Just replacespan
withdiv
in your html and it will work no additional css or anything. Below is working example.