W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2007

[whatwg] additional empty elements

From: Geoffrey Sneddon <foolistbar@googlemail.com>
Date: Wed, 2 May 2007 12:52:45 +0100
Message-ID: <4A5E6225-89E7-48EE-900E-585067CAD9E3@googlemail.com>

On 1 May 2007, at 20:21, Brenton Strine wrote:

> However, if I then wanted to add additional special
> styling to the first and third div, (e.g.. a border and
> background color) it is less graceful. I could add style
> attributes, but that would be wasteful if I want to do
> this on a large scale. Multiple classes would be
> confusing.
>
> A nice solution would be the addition of a few div tags.
> (e.g. <div2>, <div3>, <div4> and <div5>.) Then you could
> do something like this:
>
> <style>
> div1 {text-indent:0px;}
> div2 {text-indent:10px;}
> div3 {text-indent:20px;}
> </style>

Why not:

<!DOCTYPE html>
<style>
.first {
color: red;
}
.first + div {
text-indent: 10px;
}
.first + div + div {
text-indent: 20px;
color: blue;
}
</style>
<div class="first">Indent 0</div>
<div>Indent 1</div>
<div>Indent 2</div>
<div class="first">Indent 0</div>
<div>Indent 1</div>
<div>Indent 2</div>
Received on Wednesday, 2 May 2007 04:52:45 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:55 UTC