473,738 Members | 5,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

padding on hover

Hello,

I want to style an <a> element to have a special padding on "hover", like

a {padding: 3px 5px 2px 4px;}
a:hover {padding: 2px 4px 3px 5px;}

No problem for Mozilla. Opera 7, however, behaves strangely and does not
apply the background color to the padded area. And IE5 seems to ignore the
hover-padding.

Is there a workaround to achieve more compatibility?

Thomas
Jul 20 '05 #1
5 14681
Tim
On Mon, 1 Dec 2003 22:52:19 +0100,
"Thomas Mlynarczyk" <bl************ *@hotmail.com> wrote:
I want to style an <a> element to have a special padding on "hover", like

a {padding: 3px 5px 2px 4px;}
a:hover {padding: 2px 4px 3px 5px;}

No problem for Mozilla. Opera 7, however, behaves strangely and does not
apply the background color to the padded area. And IE5 seems to ignore the
hover-padding.


Some browsers, of which I recall Opera is one of them, will ignore
styling that would cause the page to be redrawn. Putting padding on a
hover would do that, as the space around the link would increase, and
shuffle everything else around it.

Redrawing a page isn't a trivial task, and a browser author may take the
simple option - and not do it. I think Opera doesn't, because it only
rendered the page once. Although seeing pages reflow once images load
in, seems to refute that notion.

--
My "from" address is totally fake. The reply-to address is real, but
may be only temporary. Reply to usenet postings in the same place as
you read the message you're replying to.
Jul 20 '05 #2
In article Tim wrote:
On Mon, 1 Dec 2003 22:52:19 +0100,
"Thomas Mlynarczyk" <bl************ *@hotmail.com> wrote:
I want to style an <a> element to have a special padding on "hover", like

a {padding: 3px 5px 2px 4px;}
a:hover {padding: 2px 4px 3px 5px;}

No problem for Mozilla. Opera 7, however, behaves strangely and does not
apply the background color to the padded area. And IE5 seems to ignore the
hover-padding.

URL?
Some browsers, of which I recall Opera is one of them, will ignore
styling that would cause the page to be redrawn.


Not Opera 7. I find that annoying, jumping links etc.
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #3
Also sprach Lauri Raittila:
URL?


Not available at the moment, sorry. But here's what I use:

a {
display:block;
width:100px;
background-color:#FFFF00;
border-top:2px solid #FFFFCC;
border-right:2px solid #999900;
border-bottom:2px solid #999900;
border-left:2px solid #FFFFCC;
padding:0px 5px 1px 5px;
}

a:hover {
background-color:#EEEE00;
border-top:2px solid #999900;
border-right:2px solid #FFFFCC;
border-bottom:2px solid #FFFFCC;
border-left:2px solid #999900;
padding:1px 6px 0px 4px;
}

The point is, the padding does not really change the layout. It just causes
the link text to be moved by one or two pixels within the "box". The sum of
top and bottom padding as well as the sum of left and right padding remain
the same. The reason why I would like this hover padding is, that the <a>
element is styled to resemble a 3D button which appears "pressed" on hover
(by inverting the border colors). But to make the effect really "3D", the
text on the button should move by one or two pixels as well.

Jul 20 '05 #4
Quoth the raven named Thomas Mlynarczyk:
Also sprach Lauri Raittila:
URL?
Not available at the moment, sorry. But here's what I use:

<snipcss> The point is, the padding does not really change the layout. It
just causes the link text to be moved by one or two pixels within
the "box". The sum of top and bottom padding as well as the sum of
left and right padding remain the same. The reason why I would like
this hover padding is, that the <a> element is styled to resemble a
3D button which appears "pressed" on hover (by inverting the border
colors). But to make the effect really "3D", the text on the button
should move by one or two pixels as well.


Here's a sample of CSS buttons that I use. They appear depressed on
hover. I think you're just missing the outset and inset. See the 3D link.
http://home.rochester.rr.com/bshagnasty/

I copied from one of my sites; hope i didn't miss anything.

--
-bts
-This space intentionally left blank.

Jul 20 '05 #5
Also sprach Beauregard T. Shagnasty:
Here's a sample of CSS buttons that I use. They appear depressed on
hover. I think you're just missing the outset and inset. See the 3D
link. http://home.rochester.rr.com/bshagnasty/


Thanks for the link, but the borders are not the problem here. In fact, I
had tried using inset and outset, but it turned out that different browsers
would render this with different border colors. Using solid borders and
applying them to the four sides individually avoids this problem and gives
me more control over the appearance.

Meanwhile I have put a test page online:
http://www.mlynarczyk-webdesign.de/tom/. Without the hover-padding. But
having tried it out on Mozilla I must say that with hover-padding the 3D
impression of the buttons is highly improved.
Jul 20 '05 #6

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

Similar topics

1
5634
by: delerious | last post by:
Could someone please take a look at this page: http://home.comcast.net/~delerious1/index11.html The set of links on the left should not have any whitespace between them, and the set of links on the right should have one pixel of whitespace between them. That's how it looks in IE and Opera. But in Mozilla, a few of the links on the left have whitespace between them, and some of the links on the right don't have whitespace between them...
14
2482
by: slim | last post by:
hi all, whilst creating a mock-up site, i am trying to follow the rules and guidelines i have been digesting over the last few months with regards to css positioning and accessibility. well, i know the journey is far from over and i'm using this mock-up as a learning process. the problem stumping me at the moment can be seen here:
6
8055
by: Thresh | last post by:
Hi all, two problems that I've been wrestling with: 1) I've got some images on a site that are links. I've got them set for 2px of padding, and a 1px border. The color changes upon hover. This works fine in IE v6 (amazingly), but it doesn't work correctly in Mozilla v1.7! It's getting the left and right padding correct, but the top padding is 7px instead of 2, and the bottom padding is 5 (instead of 2). It looks exactly right in IE,...
12
5014
by: Sander Tekelenburg | last post by:
Trying to make some images disappear on hover (works), and others appear on hover (works not). In tested browsers, this gives the expected result: IMG.disappear {visibility: visible} IMG.disappear:hover {visibility: hidden} this does not: IMG.appear {visibility: hidden} IMG.appear:hover {visibility: visible}
6
4942
by: Michael Rozdoba | last post by:
I've had some trouble getting IE to behave in respect of applying absolute positioning to a span on an a:hover. I can get it to work, but I don't understand why certain code causes it to fail to display the repositioned block. See an example at http://www.digitalrat.co.uk/test2/index.html Can anyone explain what IE thinks it's doing? The page is ugly as I've ripped most of the content & styling out to
5
4112
by: Hello | last post by:
Here problem is that in Mozilla the logo "The Website" will not pad from the edge. http://www.clickatus.com/test/ Also, when I put in loose DOCTYPE it blows the whole thing... Help... http://www.clickatus.com/test/1
1
2380
by: bissatch | last post by:
Hi, I am having a problem when setting the padding of <a> tags within a link. A stripped down version of the page can be viewed at: http://www.martynbissett.co.uk/_sfa/index_test.php Its is very basic but looking at the source CSS code (embedding in the
36
3043
by: phil-news-nospam | last post by:
Here is a simpler (no drop shadows) example of the padding bug I see: http://phil.ipal.org/usenet/ciwas/2006-05-08/buttons-1.html So far I find nothing in the CSS2 document that says I should get this kind of inconsistent result. -- ----------------------------------------------------------------------------- | Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
2
1233
by: dazhall | last post by:
hi guys, hopefully you can help me out with this one! I have a menu: <div id="menu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Online Shop</a></li> <li><a href="#">Potted Shrimps</a></li> <li><a href="#">About Us</a></li> <li><a href="#">The History of Fishing</a></li> <li><a href="#">Show Dates</a></li>
0
9473
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8208
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6750
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
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.