473,548 Members | 2,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

width and height styles on <a> tag

Hello,

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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>
Testpage
</title>
<style type="text/css">
p {
width: 50%;
background-color: #dddddd
}
a {
height: 200px;
width: 500px;
background-color: #cccccc
}
a:hover {
background-color: #cccc00

}
</style>
</head>
<body>
<h1>
Testpage
</h1>
<p>
<a href="#">Testli nk</a>
</p>
</body>
</html>

With doctype xhtml-strict turned on, the height / width on the <a> tag is
ignored.

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
larger
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.

TIA

Bye

Clemens Quoß
Jul 24 '05 #1
2 16817
Clemens Quoss wrote:
I just encountered a strange thing when switching the doctype
on and off in the following html testpage (with IE 6.0):
a {
height: 200px;
width: 500px;
background-color: #cccccc
}
With doctype xhtml-strict turned on, the height / width on the <a> tag is
ignored.

My question is: Is this the desired behaviour?
Yes.
Does xhtml-strict not allow
reformatting of the <a> tags with regard to width / height?
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.
My problem is, that I would rather like to switch background color in a
larger
area than only behind the text when hovering over the link.
Use the display property to make the link a block level element. Then
width and height will be applied.
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.


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
links. :-(

Steve

Jul 24 '05 #2
"Clemens Quoss" <Cl***********@ Dresdner-Bank.com> wrote:
With doctype xhtml-strict turned on, the height / width on the <a> tag is
ignored.


http://www.w3.org/TR/CSS21/visudet.h...eight-property
Applies to: all elements but non-replaced inline elements, table
columns, and column groups

Same wrt width.

--
Spartanicus
Jul 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1212
by: Zbigniew Lisiecki | last post by:
Hi, to show a big picture on a web page i divided it into pieces and put them together in a table:   <table>     <tr>       <td>         <a href="part1.jpg">              <img src="part1.jpg" width="150">         </a>
2
3195
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are writing one object in C# which will take the entire table tag contents and renders. Ie., we need to pass "<table>………… <thead>……</thead>. <tr>.<td>...
2
10546
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
9
2859
by: john T | last post by:
Is there any way to input he screen.height information into <Table Height=> so I can have my page auto center vertically. I don't want to use CSS because it disrupts other tables.
2
2421
by: JJ | last post by:
I'm looking to use two div elements to create two columns within a container div element. I'd like the container div to dynamically have a height greater than the internal column with the greatest height. Is there a way to accomplish this without the use of tables? I know that absolute & float elements aren't part of the flow of the page,...
1
5433
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName> <EmployeeStrength>> 1000</EmployeeStrength> When I do a Xmltextreader.read() and then check the contents of the xml node by...
1
2686
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName> <EmployeeStrength>> 1000</EmployeeStrength> When I do a Xmltextreader.read() and then check the contents of the xml node by...
1
2293
by: mike | last post by:
I've got some code like this: gametype_id = Request.Form("gametype_id") response.write "<br>gametype_id from form>" & gametype_id & "<" response.write "<br>gametype_id from database>" & rs_state("gametype_id") & "<" if gametype_id = "" then gametype_id = rs_state("gametype_id") 'could be NULL and make
3
3355
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt, &gt ,&ltCompany&gt to display '<', '>' and '<Company>' respectively. But is there any freeware code available which could implement the above...
14
3125
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the PHP interpreter works like any other, that is, it first expands all the include files, and then parses the resulting text. Can anyone help with an...
0
7512
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7438
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7951
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7803
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3475
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
751
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.