Re: [css21] multiple ID attributes with the same value

Ian Hickson wrote:
> On Mon, 14 Feb 2005, Philip TAYLOR wrote:
>>How does one abuse a "class" attribute, btw ?
>
>    <div class="body"> ... </div>
>    <div class="important"> ... </div>
>    <p class="bullet"> ... </p>
>    <div class="item"> ... </div>
>    <span class="green"> ... </p>
>    <span class="invisible"> ... </span>
>    <a class="bannerLink" ...> ... </a>
>    <p class="small"> ... </p>
>
> ...etc. Basically, any time someone uses the class attribute for
> presentational reasons ("bullet", "green", "invisible", "small"), and
> any

I agree with this. I think this is the very reason the style
attribute should be removed -- class can be abused to behave to do
the same thing. But let's not continue this way.

> time someone uses the class attribute when HTML provides means to
> provide the actual semantics ("body", "important", "item",
> "bannerLink").

I don't agree with this. If I have a paragraph of text that is
important then the only semantic markup HTML can provide me is

<p><strong>Paragraph text here</strong><p>

How do I now style such paragraph to have red border around it if
not by using class "important" or "strong" for the p element? CSS
doesn't have a way to select the p element that has child element
strong. As a workaround I could use selector "p>strong" and set the
style of strong element to undo the padding and margins of p element
and then reapply the styles usually used for p in the strong and
apply the border to strong element. But that's far from elegant
solution. It's much simpler to just stick with class="important". It
might be a slight abuse of class attribute but that's nothing
compared to CSS hacks required!

HTML doesn't allow me to write <strong><p></p></strong> event though
  all I really want is just an important paragraph.

--
Mikko

Received on Tuesday, 22 February 2005 15:33:59 UTC