본문 바로가기

홈페이지

CSS를 이용하여 text를 그림위에 놓을 때 참고

[CSS] getting visible screen height/ width

 
 
=?UTF-8?B?TWFydGluIFDDtnBwaW5n?=
Guest
Posts: n/a
 
      08-19-2006
Hello,

is it possible to ask in CSS for the visible screen width and height?

I want to define a tag like this

div#foo{
left: $screenwidth/2-500px;
}

if there is any chance to ask for the screen width like it´s done with 
"$screenwidth" in my improvisational example.



Regards,

Martin
 
Reply With Quote
 
Ads by Google

OLED Materials Markets 
Market Research Report - 2012 Get More Info
www.NanoMarkets.net
 
 
 
Spartanicus
Guest
Posts: n/a
 
      08-19-2006
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
 
Reply With Quote
 
Ads by Google

The Latest on HTML5 
Get the latest articles now at: The HTML5 Development Center
www.htmlgoodies.com/html5/
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      08-20-2006
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