Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Clemens Quoss
June 29, 2005, 7:37 pm
rate this thread
I just encountered a strange thing when switching the doctype
on and off in the following html testpage (with IE 6.0):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
With doctype xhtml-strict turned on, the height / width on the <a> tag is
My question is: Is this the desired behaviour? Does xhtml-strict not allow
reformatting of the <a> tags with regard to width / height?
My problem is, that I would rather like to switch background color in a
area than only behind the text when hovering over the link. I could easily
embed the <a> tag in a paragraph <p> of appropriate size, but then color
switching while hovering is only performed on the small <a> tag.
Any help is appreciated.
Re: width and height styles on tag
Clemens Quoss wrote:
CSS doesn't allow it. The width and height properties do not affect
inline elements like <a>.
The doctype you used is one of those that triggers standards mode in
which the standards are obeyed. Other doctypes, or no doctype at all,
triggers quirks mode in which all sorts of strange things are done.
Use the display property to make the link a block level element. Then
width and height will be applied.
If you want to change the background of an entire p element then you
need to use p:hover instead of a:hover, but IE only supports :hover on