I am finding I'm writing a lot of code that looks like this:
<div id="leftCol">
<div style="padding-top:10px">
<asp:Image ID="imgRazor1" ImageUrl="http://www.example.com/dynimg.aspx?imageKey=XXX" runat="server" />
</div>
<div style="padding-top:10px">
<asp:Image ID="imgRazor2" ImageUrl="http://www.example.com/dynimg.aspx?imageKey=XXX_CART" runat="server" />
</div>
<div style="padding-top:20px; padding-bottom:15px">
<asp:Image ID="Image3" ImageUrl="~/images/announcements/announcement1.jpg" runat="server" />
<div style="font-size:x-small">(from example.com)</div>
</div>
</div>
Thats to say I am putting a lot of explicit padding or margins.
I'm wondering what a better approach to this is without ending up with class names like these:
.mediumPadding {
padding-top:10px;
}
.smallPadding {
padding-top:5px;
}
.padding15 {
padding: 15px
}
When I'm coding actual CONTENT like this as opposed to more generic overall LAYOUT I tend to find that specific padding sizes are more appropriate. I'll find myself changing from 8px to 11px and then back to 9px. It must be the designer in me, but I dont really like the habit that I'm forming.
I dont see myself being able to revisit a global rule that says 'medium padding' is 9px and changing it to 11px and expecting satisfactory results. It may make some pages look nicer and make ruin others.
What do other people do to solve this problem? I want benefits of css, but I need fine control.