HTML link with addition and active CSS style does not work in Google Chrome, Apple Safari, Opera, Mozilla Firefox. However, it works in Internet Explorer 8.
Here is a sample code. Try clicking Stack - the link does not work, click the Overflow - link. By work, I mean go to the StackOverflow website.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>css active padding href problem</title> <style type="text/css"> a{ display: inline-block; background:#CCC; border:1px solid #666; padding:0 35px 0 0; } a:active{ padding:0 0 0 35px; } </style> </head> <body> <div> <p>Click on <i>Stack</i> - href does not work. Click on <i>Overflow</i> - href works. All browsers are affected. Except IE.</p> <a href="http://stackoverflow.com/">StackOverflow</a> </div> </body> </html>
Why does this not work in most browsers?
Edit 2: If you change: active to: hover, then everything will work as expected in all browsers - a click occurs and the browser goes to stackoverflow.com
Edit 3: To prove that you can click on the fill area, you can change the style:
<style type="text/css"> a{ padding:0 0 0 35px; } </style>
If the link is โmovingโ, as someone mentioned, then why can you click on the already โmovedโ link?
html css padding anchor
Maris B.
source share