Re: inheritance from nonancestor

This case is also explicitly covered in the HTML Living Standard
<https://html.spec.whatwg.org/multipage/semantics.html#the-hgroup-element>:
>
> <hgroup>
> <h1>Dr. Strangelove</h1>
> <h2>Or: How I Learned to Stop Worrying and Love the Bomb</h2>
> </hgroup>


On Fri, Mar 4, 2016 at 11:11 AM, Davis, Greg <greg.davis@pearson.com> wrote:

> Hi Nick,
> One option to fix your problem here would be to use sectioning tags
> like <article>, <aside>, <nav> and <section> and then use <header> to
> contain the <h1> and subtitle elements. The pattern we use in book
> production, and one that is sanctioned by the IDPF for EDUPUB content is:
> <section>
>     <header>
>         <h1>Title</h1>
>         <p class="subtitle">Subtitle</p>
>     </header>
>     ...
> </section>
>
> Of course, if the <h1> is the title to your whole page, <header> can also
> act as a child of <body> for the same purpose, and then each cascading
> <section> get's <h2>, <h3>, etc. The other benefit of <header> is that it
> can contain all kinds of things that are "header" material. Search
> elements, logos, etc... are all game for inclusion.
>
> -Greg
>
>
> On Wed, Mar 2, 2016 at 11:10 PM, Nick Levinson <nick_levinson@yahoo.com>
> wrote:
>
>> It would help if we could inherit nonancestral style. This would improve
>> consistency across browsers. To that end, we apparently need an addition to
>> the CSS specs. Test case: For the sake of a search engine, only one h1
>> element should appear on a page, but I want a subtitle with a slightly
>> smaller font-size. So writing two h1 elements, even with different classes
>> or id values, is out. And writing the subtitle as h2 immediately after the
>> h1 is also out. Both are forbidden by HTML5, section 4.12.1. But if I write
>> and style a p element then I have to predict the particulars of how various
>> browsers will style h1 in order to have the p element have the same look as
>> the h1 gets except for differences I specify (probably just the fontsize).
>> Instead, I created a hack (as in <h1>Main Title<br
>> /><span>Subtitle</span></h1> (see
>> https://css-tricks.com/forums/topic/how-to-inherit-from-nonparent-element/))
>> but haven't tested it much (but see
>> https://css-tricks.com/forums/topic/how-to-inherit-from-nonparent-element/
>> in case of possible responses) and wonder if, even with enough testing, a
>> more semantic way wouldn't be better.
>>
>> --
>> Nick
>>
>>
>>
>>

Received on Friday, 4 March 2016 17:19:11 UTC