I am trying to set the the attributes (border, width, etc) of a href tag using CSS.

But it is being very annoying!

Padding is working and color and thats just about it.

Width, height, borders (only see 2/3 out of the 4 sidded box), etc.

Any ideas?

Thanks, Regards X

PS: Note when I use the style on other tags there are different outcomes.

9 Years
Discussion Span
Last Post by OmniX

A href tag is only link, you can't set border, height, width.

These attributes you can set to any <div id="">, <img> tags and other, which be bounded between <a href="#"></a>.

Show here your code, because we don't know, what you need create with code.


pretty much just using css to make a href a box.

style="border: 3px solid; etc";

so you saying if i encapsulate it inside a div tag it will work?


E.g. like this

In HTML file will be:

<a href="#"><div id="box">Active box</div></a>

In CSS file will be:

	width: 160px;
	height: 180px;
	background-color: black;
	border: 3px solid #A2A2F2;
	color: white;
	font-size: 36px;

This is only short example..


That won't validate - it's tag soup.

The anchor tag is an inline tag, and you can't put a block tag pair inside an inline tag pair. Div is a block tag.

You can't put box properties on inline tags either.

Put the anchor inside the div instead, and attach the box properties to the div.


Thats what I thought so should be like:

 <a href>

Thats it?

Been to busy at work to test it.

Regards, X

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.