Michael Zajac
Web design and photo vr
Optimized Style Sheet for an XML Link
Here’s an XML link, styled using Cascading Style Sheets: XML
This code is based on Dylan Greene’s CSS XML button. It is slightly optimized to reduce the size of the code to 205 bytes. If you use more than one orange button on your web site, you could reduce the total bytage by using a class attribute and tucking the CSS away in your site style sheet.
The code
<a title="RSS 2.0" href="rss.xml" style="border:1px solid;border-color:#FC9 #630 #330 #F96;padding:0 3px;font:bold 10px verdana,sans-serif;color:#FFF;background:#F60;text-decoration:none;margin:0;">XML</a>
Optimizations
- Applied the style attribute directly to the
<a href>
element, and removed the<span>
. - Removed spaces after semicolons.
- Used the
background
shortcut property instead ofbackground-color
. - Removed redundant border and padding values (
padding:0px 3px 0px 3px;
becomespadding:0px 3px;
). - Removed units for zero dimensions (
0px
becomes0
). - Shifted arbitrary colour values to the nearest web-safe colour (
#FFC8A4
becomes#FFCC99
). - Used three-character colour triplets (
#FFCC99
becomes#FC9
).
© Michael Zajac 1999–2003