473,493 Members | 4,355 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Another Vertical-Alignment Problem (Sorry)

2 New Member
Hello,

I've read numerous posts & guides on this subject but i'm still having problems. I'm writing some HTML for the company intranet and all our browsers are currently (you guessed it) IE6.

In most of the guides that I've read you can "fix" this problem in IE6 by nesting a series of divs inside each other and fiddling the margins. However this only seems to work when you know the size of the content you're putting in. It also seems to run into trouble when your container is inside a table (as is the case with me). Just to add further insult I'm also working in flow layout (or whatever the term is, NOT absolute :) )

I've got a table containing link buttons (represented as DIVs inside Anchor Tags). This is immediatly a problem as IE6 apparently doesn't supports divs in anchors but it seems to work. I'm using Javascript for the rollovers since IE6 doesn't seem to like aligning the text on Hover when I use pseduo classes.

The problem is that I'd like to vertically center the button text inside the div. Everything I've tried thus far hasn't worked. I could next another div inside and specify a "top" value manually but I'd like to avoid manually setting each one if I can.

Could anyone make any suggestions?

example code (excluding my failed attempts at vertical align) to follow, cheers,

Olly

CSS:

DIV.buttonOff
{
background-image:url(myImage1.png);
background-repeat:repeat-y;
background-position: top left;
width:100px;
height:60px
}

DIV.buttonOver
{
background-image:url(myImage2.png);
background-repeat:repeat-y;
background-position: top left;
width:100px;
height:60px
}

Script:

function doOver (element)
{
element.className = "buttonOver";
}

function doOff (element)
{
element.className = "buttonOff";
}

Html:

<table>
<tr>
<td valign="center" align="center"><a href="myRef.com"><div class="buttonOff" onmouseover="doOver(this)" onmouseout="doOff(this)" align="center">My Multi Line Quite long Button text</div></a>
</td>
<td valign="center" align="center"><a href="myOtherRef.com"><div class="buttonOff" onmouseover="doOver(this)" onmouseout="doOff(this)" align="center">short btn txt</div></a>
</td>
</tr>
...etc...
</table>
May 25 '07 #1
4 3282
drhowarddrfine
7,435 Recognized Expert Expert
IE6 apparently doesn't supports divs in anchors but it seems to work.
Anchors are 'inline' but divs are 'block' elements.

I don't see the need to have a cell around a div to do this. I don't see the purpose of the div. You also have some errors because "middle" isn't correct everywhere there.
May 25 '07 #2
O11Y
2 New Member
Sorry for the late reponse. I'm not sure what you mean by "Cell" around the div?.

I'm using a table for layout purposes. The above HTML was an example, not every TD will have a button.

An obvious choice to do this would be to use <IMG> s but I want the text for the buttons to be dynamically configurable. I will be using ASP to control their text.

I haven't used "middle" anywhere so I'm a bit confused by that comment. As far as I know the HTML VAlign tag uses "center" as opposed to middle but please correct me on that. Either way, the TDs are correctly valigning.

If you can suggest the way I should be doing this then that would be very useful as opposed to just pointing out my flaws.

Cheers,
Jun 1 '07 #3
drhowarddrfine
7,435 Recognized Expert Expert
I'm not sure what you mean by "Cell" around the div?.
<td> is a table data cell and you have a div inside the cell:
[HTML]<td valign="center" align="center"><a href="myOtherRef.com"><div[/HTML]
Since a cell encloses those contents, what is the purpose of the div?
I'm using a table for layout purposes.
Never use tables for layout. They are for data only. Use CSS.
As far as I know the HTML VAlign tag uses "center" as opposed to middle
It uses "middle".
If you can suggest the way I should be doing this then that would be very useful as opposed to just pointing out my flaws.
So you don't want me to point out errors in your markup but you want your markup to work correctly?

I see what you are trying to do but I'll need a minute.
Jun 1 '07 #4
drhowarddrfine
7,435 Recognized Expert Expert
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
</head>
<body>
<table>
<tr>
<td style="height:100px;width:100px;background-image:url(myimage1.png)">
<div>
<a href="#">
My Multi Line Quite long Button text
</a>
</div>
</td>
</tr>
</table>
</body>
</html>[/HTML]
Jun 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
12407
by: kAldam | last post by:
I am currently using IE 6.0 and 5.5 and the scenario is the following. I have a span that contains text, and the span is beign contained by a table cell (this is the way thing need to be in my...
3
2450
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a...
2
12121
by: Eric Lindsay | last post by:
If I want to have the middle of an image vertically aligned with the middle of a heading (or several lines of heading), is there some particular way people would recommend? vertical-align: center...
4
2260
by: shivas | last post by:
Hi, I am using vertical-align for a table row, but the Image and the text are not aligned properly. I don't what to align image in the img tag, rather in the row itself I want to align. I want...
5
4807
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
3
4395
by: acunnon | last post by:
I am trying to put together an login page my problem is getting the three items aligned to the middle verticaly without specifing a height to anything on the page. CSS html{ height:100%;...
10
3677
by: sklett | last post by:
I have a situation where I'm getting in Image that has a gray (solid, same color) background with a smaller white rectangle inside. The position is not always the same. What I need to do is...
3
5146
by: Spiros Bousbouras | last post by:
The fact that vertical tab and form feed exist both in the basic source character set and the basic execution character set suggests to me that there is a class of display devices where vertical...
0
977
by: Joe Stateson | last post by:
My default.aspx page has two div's. The top div holds a menu and the bottom one holds a 3rd party tabstrip with 10 pages of varying height. I only want a single vertical scroll bar, the browser...
40
5424
by: maya | last post by:
hi, how do I get text to vertical-align inside a div? http://www.mayacove.com/misc/home.html vertical-align should work, according to this:...
0
7118
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,...
0
6980
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...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6862
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...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4886
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...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.