Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Wrong MouseOver area in Mozilla Firefox and Opera (http://www.velocityreviews.com/forums/t709921-wrong-mouseover-area-in-mozilla-firefox-and-opera.html)

Stefan Mueller 12-26-2009 07:22 PM

Wrong MouseOver area in Mozilla Firefox and Opera
 
The following code works in Internet Explorer perfect. If you move the
mouse pointer over the red header area the header text gets
highlighted.
But in Mozilla Firefox and Opera the header text gets already
highlighted before the mouse pointer is over the red header area (it
needs to be only close to the red header area).

=====================================

<html>
<head>
<style type="text/css">
th {
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom: 0px;
background-color: #ff0000;
}

div.header_inside {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
padding-left: 7px;
padding-right: 7px;
padding-top: 4px;
padding-bottom: 4px;
width: 100%;
height: 100%;
}

div.header_outside {
color: #000000;
position: relative;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
padding-left: 7px;
padding-right: 7px;
padding-top: 4px;
padding-bottom: 4px;
width: 100%;
height: 100%;
}

div.header_outside_mouseover {
color: #ffffff;
position: relative;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
padding-left: 7px;
padding-right: 7px;
padding-top: 4px;
padding-bottom: 4px;
width: 100%;
height: 100%;
}

td {
background-color: #0000ff;
}
</style>
</head>

<body>
<table width = "150px">
<thead>
<tr>
<th>
<div class = "header_outside"
onMouseover = "className = 'header_outside_mouseover'"
onMouseout = "className = 'header_outside'">
Column 1
<div class = "header_inside"></div>
</div>
</th>
</tr>
</thead>

<tbody>
<tr><td>1</td></tr>
<tr><td>2</td></tr>
<tr><td>3</td></tr>
</tbody>
</table>
</body>
</html>

=====================================

I tried to modify the following lines
padding-left: 7px;
padding-right: 7px;
padding-top: 4px;
padding-bottom: 4px;
to
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom: 0px;

Then it works also in Mozilla Firefox and Opera but my header doesn't
have the same formatting anymore.

Doug Miller 12-26-2009 07:55 PM

Re: Wrong MouseOver area in Mozilla Firefox and Opera
 
In article <55611bbc-b622-4fcb-934c-ee70d8647231@a21g2000yqc.googlegroups.com>, Stefan Mueller <seekware@yahoo.com> wrote:
>The following code works in Internet Explorer perfect. If you move the
>mouse pointer over the red header area the header text gets
>highlighted.
>But in Mozilla Firefox and Opera the header text gets already
>highlighted before the mouse pointer is over the red header area (it
>needs to be only close to the red header area).


Develop for Firefox and Opera first, then modify as necessary to make it work
in IE. In this case, ISTM that the problem is caused by IE's incorrect box
model. It's easy enough to fix; change your padding and margin styles as
needed to make it work properly in FF, and then use conditional comments to
modify those styles for IE.

Stefan Mueller 12-26-2009 08:21 PM

Re: Wrong MouseOver area in Mozilla Firefox and Opera
 
> Doug Miller wrote:
> Develop for Firefox and Opera first, then modify as necessary to make it work
> in IE. In this case, ISTM that the problem is caused by IE's incorrect box
> model. It's easy enough to fix; change your padding and margin styles as
> needed to make it work properly in FF, and then use conditional comments to
> modify those styles for IE.


Ok, good to know.
But if I really have to set
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom: 0px;
then I'm not able to format the table like in the example above.

Stefan

Doug Miller 12-27-2009 01:21 AM

Re: Wrong MouseOver area in Mozilla Firefox and Opera
 
In article <55611bbc-b622-4fcb-934c-ee70d8647231@a21g2000yqc.googlegroups.com>, Stefan Mueller <seekware@yahoo.com> wrote:
>The following code works in Internet Explorer perfect. If you move the
>mouse pointer over the red header area the header text gets
>highlighted.
>But in Mozilla Firefox and Opera the header text gets already
>highlighted before the mouse pointer is over the red header area (it
>needs to be only close to the red header area).
>
>=====================================
>
><html>
> <head>
> <style type="text/css">
> th {
> padding-left: 0px;
> padding-right: 0px;
> padding-top: 0px;
> padding-bottom: 0px;
> background-color: #ff0000;
> }
>
> div.header_inside {
> position: absolute;


Why?

> left: 0px;
> right: 0px;
> top: 0px;
> bottom: 0px;
> padding-left: 7px;
> padding-right: 7px;
> padding-top: 4px;
> padding-bottom: 4px;
> width: 100%;
> height: 100%;
> }
>
> div.header_outside {
> color: #000000;
> position: relative;


Why?

> left: 0px;
> right: 0px;
> top: 0px;
> bottom: 0px;
> padding-left: 7px;
> padding-right: 7px;
> padding-top: 4px;
> padding-bottom: 4px;
> width: 100%;
> height: 100%;
> }
>
> div.header_outside_mouseover {
> color: #ffffff;
> position: relative;


Why?

> left: 0px;
> right: 0px;
> top: 0px;
> bottom: 0px;
> padding-left: 7px;
> padding-right: 7px;
> padding-top: 4px;
> padding-bottom: 4px;
> width: 100%;
> height: 100%;
> }
>
> td {
> background-color: #0000ff;
> }
> </style>

[snip]
>


Replace your style sheet with the following:

<style type="text/css">
th {
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
padding-bottom: 0px;
background-color: #ff0000;
}

div.header_outside {
color: #000000;
padding-top: 4px;
padding-bottom: 4px;
}

div.header_outside_mouseover {
color: #ffffff;
padding-top: 4px;
padding-bottom: 4px;
}

td {
background-color: #0000ff;
}
</style>

Stefan Mueller 12-27-2009 01:36 AM

Re: Wrong MouseOver area in Mozilla Firefox and Opera
 
On Dec 27, 2:21*am, spamb...@milmac.com (Doug Miller) wrote:
> Replace your style sheet with the following:
>
> * * <style type="text/css">
> * * * th {
> * * * * padding-left: * * 0px;
> * * * * padding-right: * *0px;
> * * * * padding-top: * * *0px;
> * * * * padding-bottom: * 0px;
> * * * * background-color: #ff0000;
> * * * }
>
> * * * div.header_outside {
> * * * * color: * * * * * *#000000;
> * * * * padding-top: * * *4px;
> * * * * padding-bottom: * 4px;
> * * * }
>
> * * * div.header_outside_mouseover {
> * * * * color: * * * * * *#ffffff;
> * * * * padding-top: * * *4px;
> * * * * padding-bottom: * 4px;
> * * * }
>
> * * * td {
> * * * * background-color: #0000ff;
> * * * }
> * * </style>-


With your style sheet it's not the same anymore. I'm able to select
the text in the header (e.g. with a double click) in IE and FF.
With which browser have you tested your style sheet?

Doug Miller 12-27-2009 02:36 AM

Re: Wrong MouseOver area in Mozilla Firefox and Opera
 
In article <6ed0d17e-8969-4ea3-9e2e-364acfdd8c2f@p8g2000yqb.googlegroups.com>, Stefan Mueller <seekware@yahoo.com> wrote:

>With your style sheet it's not the same anymore. I'm able to select
>the text in the header (e.g. with a double click) in IE and FF.


I'm able to select it with your style sheet too, just not with a double-click.
Try clicking outside the red box and dragging the mouse pointer across the
text.

>With which browser have you tested your style sheet?


FF.

I didn't intend that to be the final form; you'll need to do some tweaking, of
course -- but I got rid of the stuff that was causing your mouseover problems.
Why did you have absolute and relative positioning on those divs? What was
that supposed to accomplish?

Stefan Mueller 01-07-2010 09:58 AM

Re: Wrong MouseOver area in Mozilla Firefox and Opera
 
On Dec 27 2009, 3:36*am, spamb...@milmac.com (Doug Miller) wrote:

> I'm able to select it with your style sheet too, just not with a double-click.
> Try clicking outside the red box and dragging the mouse pointer across the
> text.


You're absolutely right. You're able to select it even with my style
sheet but not with a double click. That's exactly how it should be.
I'm programming a function which allows a user to sort a html table by
clicking on its column headers. The annoying feature in this case is
that if you click quite fast on a column header to sort the table
ascending and then descending the text gets selected. With my style
sheet I can avoid this. That's also the reason why I have absolute and
relative positionings on the DIVs. In IE it works fine but like
mentioned in this post - what is the cause for this post - in Mozilla
Firefox and Opera the header text gets already highlighted before the
mouse pointer is over the red header area.

If someone has an idea how to do it without absolute and relative
positionings please let me know. However I think I do need absolute
and relative positionings to achieve this and therefore I need to
solve the problem that in Mozilla Firefox and Opera the header text
gets already highlighted before the mouse pointer is over the red
header area.

Stefan


All times are GMT. The time now is 06:44 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57