Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 1, 2026.

How to do something...

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

thetzfreak

Established Member
Impact
19
Hi,

I'm making a box around a link. I'm using this simple css code for the box:

.links {
border: 2px dotted #5b5b5b;
background: #e5e5e5;
}

I will use it like this: <div class="links"><a href="linkhere">Link</a></div>

Now, how do I automatically make the box width the same as the link text?

Thanks a lot.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
I'm not a CSS expert, but here are two options that work.

instead of div, try span:

PHP:
<span class='links'><a href="linkhere">Link</a></span>

or just put it in the 'a' tag:

PHP:
<a class="links" href="linkhere">Link</a>
 
0
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back