I have written the following CSS to style the hyperlinks on my page: a:link { text-decoration: none; background-color: #C00000; color: white; padding: 5px; } Code (markup): In FF this displays as intended (a 'box' hyperlink with 5px padding around the text). However in IE the top and bottom padding does not display, only the left and right. Is there another CSS property to specify for IE?
OK I fixed it, I had to specify padding on the DIV itself. But now I have another problem. When I zoom the page in or out (using IE7) the text does not stay within it's 'box'. Does anyone know why?
Yes its because the <a> anchor element is in-line, therefore if you give it widths heights margins or paddings it will be ignored, unless you set it to display: block; Elements like a DIV and P are block elements, whereas SPAN and A are in-line elements. in-line elements appear next to each other whereas block elements appear undeneath each other. That's why we sometimes float block elements so that they can appear next to each other rather than undeneath one another.