Dynadot โ€” .com Registration $8.99

How to do something...

Spaceship Spaceship
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
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back