I'm a bit stuck here with my CSS.
#blabla a {
width: 150px;
}
<div id="blabla">
<a href="#">fgdfg</a>
</div>
But the link won't be 150px wide. I've tried span, p, tt and so on, but it won't help. The link is inside a list, but I've got other styling for the list, so that won't work.
CSS: Width of a link
Moderator: General Moderators
Re: CSS: Width of a link
Hi
I'm not sure if this is considered bad code or anything but last night I used:
To set the width of a link.
Seems to work for me.
I'm not sure if this is considered bad code or anything but last night I used:
Code: Select all
a{display: block; width: 100px;}Seems to work for me.
Re: CSS: Width of a link
An <a> element is inline. As a result, you can't set it's width. Setting it to display as a block element (such as ~JKM suggested) or floating it will allow you to set it's width.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.