It seems like you have utilized an element with a display: block
property for your .border
class:
.border {
border: 1px solid #cc0000;
border-radius: 8px;
width: 100%;
padding: 5px;
}
<div class="border">
<a href="https://google.com">Google</a>
</div>
The default display
value of <div>
is block
, resulting in full width.
To resolve this, consider utilizing an element with display: inline
:
.border {
border: 1px solid #cc0000;
border-radius: 8px;
width: 100%;
padding: 5px;
}
<span class="border">
<a href="https://google.com">Google</a>
</span>
Alternatively, you can directly add display: inline
to the styles of your .border
class:
.border {
border: 1px solid #cc0000;
border-radius: 8px;
width: 100%;
padding: 5px;
display: inline; /* <---- */
}
<div class="border">
<a href="https://google.com">Google</a>
</div>