EDIT
I made this new answer because I believe that the previous one was not the best option, both semantically and the features that CSS offers that should be used in the correct way and not with "way" to work.
First see that HTML has the tag <q> ... </q>
where Q means quote See what the Mozilla documentation says about this tag: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/q
The HTML element <q>
indicates that the attached text is a short quotation in line. Most modern browsers implement this by enclosing the text in quotes.
Then see that CSS has the attribute quote
where it is possible to customize the type of quotation mark that you want to use. https://developer.mozilla.org/en-US/docs/Web/CSS/quotes
The CSS property quote
indicates how user agents should render quotes.
Ex:
q {
quotes: '“' '”';
}
Now see when the tag <q>
is rendered by the browser it includes two pseudo-elements ::before
and ::after
automatically.
Now the answer I believe is most appropriate
First don’t put the ::before
and ::after
on the tag <h5>
, in that case use the tag <q>
within the title tag: <h5><q>...
Now just set the type of quote
that you want (quotation marks), and then stylize the ::before
and ::after
tag <q>
See how the result of custom quotes and default quotes placed directly inside the text. OBS: I left the comments in the code
div {
width: 400px;
margin: 0 auto;
}
h5 {
font-family: 'Libre Baskerville', sans-serif;
font-size: 32px;
text-align:center;
}
q::before, q::after {
quotes: '“' '”' ; /* estilo das aspas */
color: red; /* cor das aspas */
font-size: 40px; /* tamanho da fonte das aspas */
position: relative;
top: 4px; /* altura das aspas relativas ao texto, ajuste ótico devido a variação do tamanho da fonte das aspas*/
}
<div>
<h5><q>sit amet consectetur</q></h5>
<h5><q>Lorem ipsum dolor sit amet consectetur adipisicing elit. Expedita, consequatur.</q></h5>
<h5>Lorem ipsum dolor "sit amet consectetur" adipisicing elit.</h5>
</div>
A CSS-only option
Look I don’t know if there’s any other CSS influencing your code, but here’s a normal setting in top
and bottom
with position:absolut
NOTE: I separated the shorthand of font
to better visualize the attributes.
In the top:
you control the time you want just like in bottom
and uses margin
and padding
to give the spacing between the quotation marks and the text.
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.interna {
width: 40%;
margin: 0 auto;
}
.noticias .interna H5{
width:100%;
line-height: 33px;
font-weight: normal;
font-size: 23px;
font-family: 'Libre Baskerville', sans-serif;
text-align:center;
color:#333333;
padding-bottom: 0;
position: relative;
}
.noticias .interna H5::before{
content: "“";
line-height: 33px;
font-weight: normal;
font-size: 50px;
font-family: 'Libre Baskerville', sans-serif;
position: absolute;
top: 0.5rem;
margin-left: -1.5rem;
}
.noticias .interna H5::after{
content: "”";
line-height: 33px;
font-weight: normal;
font-size: 50px;
font-family: 'Libre Baskerville', sans-serif;
position: absolute;
bottom: -0.5rem;
padding-left: 10px;
}
<div class="noticias">
<div class="interna">
<h5>Lorem ipsum dolor psa!</h5>
</div>
</div>
<div class="noticias">
<div class="interna">
<h5>Lorem ipsum dolor sitanimi eveniet laborum ipsa a!</h5>
</div>
</div>
<div class="noticias">
<div class="interna">
<h5>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur hic ullam fugiat! Veniam accusamus voluptates animi eveniet laborum ipsa a!</h5>
</div>
</div>
Put your html with the div etc, it is better to give you an accurate answer
– hugocsl
I’ve done it before posting and the result is the same the final quote goes up
– user4451
Have you thought of a solution via Javascript?
– Sam
Not because I didn’t think it would be necessary, but I guess I’ll have to find a way to do with!!
– user4451
Dude I posted an answer where I could adjust using
top
same. But if that’s not what you need tell me I’ll edit there if I have to.– hugocsl
It would be something like this using JS: https://jsfiddle.net/6fk1xdv7/
– Sam
You can even put the first quotes by JS tb, to be next to the first word of the text.
– Sam
I was going to put image but this solution there is better vlw I think I’ll stay with her even
– user4451
I’ll remove the answer for now, when I think of something I’ll give you an idea
– hugocsl
Dude I made a simple adjustment in CSS and I think now it’s the way you wanted, in case you don’t want to use the JS option now you have an option only with CSS. [] s
– hugocsl