I have a simple warning message:
HTML
<span id="j_idt68" class="aviso">
<a href="MEU LINK">message</a></span>
CSS
span.aviso a {
padding:20px 35px;
background: rgb(255, 174, 174);
background: rgba(255, 174, 174, 0.3);
border:1px solid #FF1C1C;
border-radius:10px;
color:#FF0000;
text-align: center;
opacity:1;
margin:0 auto;
font-size:14px;
display:block;
}
I declared the width of the span to be 960px because I want the message to be centered but I don’t want the rounded rectangle site to be 960px, I would like it to adjust it’s width according to the size of the text
The
aelement isn’t inheriting the width; instead, you are settingdisplay: blockon it, making its width the entire available width. You need to separate the settings so that thespanaligns text lines inside it and theaelement isinline-block(or defaulted toinline, but then you have line height problems). Like this: