I'm looking to produce the effect that is on this page: http://jonrohan.me/guide/css/creating-triangles-in-css/ - but with just CSS, no JavaScript (this would be trivial with JavaScript).
The effect I'm talking about is as follows:
- Initially you see both the page header and the article title.
- when you scroll the page header disappears.
- The article title becomes fixed to the top of the page, so you always see it as you scroll.
The best I've managed to achieve so far is this:
http://jsfiddle.net/nottrobin/2FSvx/
But I don't like the duplication of the <nav>
inherent in my solution.
Does anyone have any clever CSS/3 techniques they can think of to make it so that when you scroll down and the <header>
disappears, the <nav>
would naturally ride up to the top of the page?
<header>
with the<nav>
inside aposition: fixed
<div>
, and then making the<header>
static, with the hope that the<header>
would scroll up and leave just the<nav>
in the fixed<div>
. Didn't work. Also tried absolutely positioning<header>
, but that didn't work either. I still kinda hope there might be a hack to make the<header>
notposition: fixed
but somehow have it still push down the<nav>
element. Gonna keep playing. – Blossomblotposition: relative
, which it must be for the child to follow it). – Shintoposition
s (static
,fixed
,relative
,absolute
) interact with each other in different situations? – Blossomblot