I want to increase the height of a A href tag in xhtml strict, but also need to align the text centre by using a line-height which only works with inline elements, but need the height attribute to work which means it needs to be block level. Any suggestions ?
Hi,
I’m not sure where the anchor is at on your page, whether it is wrapped in an LI or in a string of text. Depending on where it is at will determine what you do to set a height.
As you have stated the anchor needs to be a block in order to take on dimensions. That can be obviously be done by setting it as display:block. But it can also be floated or set as display:inline-block to generate a block box around it.
If it is in a horizontal menu then you could float it. If it is an anchor within a string of text then inline-block would work. If it is a vertical menu then display:block will work.
And you can set a line-height on any of those block boxes that is the same as their height to center the text vertically.
Thanks for that, I really shouldnt keep posting these up in lazyness, I just started again from scratch and it worked first time, using display block , dunno what happen before.
Thanks again , much apreciated.