adding :first-child to entries

In the never-ending effort to streamline the production of the site (or just to amuse myself), I’ve added a :first-child pseudo-class to the CSS.

This means that the first <p> in every entry is automatically given a bold style. The code is:

.entry>p:first-child {

font-weight: bold;

}

The text for each post is contained within a <div> with a class of ‘entry’ and is made up of a series of <p>s (plus some <div>s at the end which we can ignore in this case). Previously I’ve been adding <strong> tags to the first <p> as a general stylistic thing. :first-child allows me to not have to add these tags and will style the entry appropriately when it hits the site.

Pros: less code. Cons: no preview until it’s live (fix: create a new stylesheet for ecto).

Part of the CCS2 spec, doesn’t work in IE

Technorati Tags: , , , , ,

Creative Commons License
adding :first-child to entries by escdotdot is licensed under a Creative Commons Attribution 4.0 International