[CSS] getting visible screen height/ width
Spartanicus Guest Posts: n/a |
Martin Pöpping <> wrote: >is it possible to ask in CSS for the visible screen width and height? There are CSS3 media queries http://www.w3.org/TR/css3-mediaqueries/ but browser support is poor. >I want to define a tag like this > >div#foo{ > left: $screenwidth/2-500px; >} If you want meaningful help don't present a fantasized solution, present the problem. -- Spartanicus | ||
![]() | |||
The Latest on HTML5 Get the latest articles now at: The HTML5 Development Center www.htmlgoodies.com/html5/ | |||
Toby Inkster Guest Posts: n/a |
Martin Pöpping wrote: > is it possible to ask in CSS for the visible screen width and height? No. And even if you could, what use would it be? Browser canvas size is a lot more useful. > div#foo{ > left: $screenwidth/2-500px; > } Try: div#foo { width: 500px; left: 50%; margin-left: -250px; } (think about it and you'll see why it works) -- Toby A Inkster BSc (Hons) ARCS Contact Me ~ http://tobyinkster.co.uk/contact |