W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2016

Re: [csswg-drafts] [css-page] control space before element depending on page position

From: Tobias Fischer via GitHub <sysbot+gh@w3.org>
Date: Wed, 29 Jun 2016 13:55:15 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-229363009-1467208513-sysbot+gh@w3.org>
Hi Sebastian,

thanks for pointing us to the issue tracker and for your first answer.

I don't think that `:first-of-type` is a solution for 
@christin-goetz's requirement as it does not take into account the 
current position on the page (which may be unequal to the current 
position in the DOM).

Say weh have the following structure:
```
<h1>
<p>
<p>
...
<p>
<h2>
<p>
<p>
<h2>
<p>
<p>
```
and the following css snippet
```
heading {
    margin-top: 2em;
    }
``` 

The `h2` element should display WITH margin top when rendered 
somewhere on the page, surrounded by paragraphs. But it should render 
WITHOUT margin top when it is the first item on the new page.

The `:first-of-type` selector would only match the first occurance of 
`h2` regardless of whether or not it is rendered at the bottom or as 
the first item on the page. And it wouldn't even match the 2nd 
occurance.

Did this example made our point clearer?

Regards,
Tobias

-- 
GitHub Notification of comment by tofi86
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/253#issuecomment-229363009 
using your GitHub account
Received on Wednesday, 29 June 2016 13:55:24 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:40:59 UTC