473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

screen size detect - select CSS

I have started looking into scripts for screen size detect with the
intention of using them to pick from a number of CSS style sheets tailored
to the size.

Is there a good reason why this is not so commonly done? IE am I wasting my
time?

---dE|_---
Nov 7 '07 #1
24 2967
dE|_ wrote on 07 nov 2007 in comp.lang.javascript:
I have started looking into scripts for screen size detect with the
intention of using them to pick from a number of CSS style sheets
tailored to the size.

Is there a good reason why this is not so commonly done?
screen size != window size != window display size.

IE am I wasting my time?

Also FF [fery futile].

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 7 '07 #2
dE|_ wrote:
I have started looking into scripts for screen size detect with the
intention of using them to pick from a number of CSS style sheets tailored
to the size.

Is there a good reason why this is not so commonly done? IE am I wasting my
time?

---dE|_---

Bad idea. I once found a website I needed to get information from which
appeared totally blank. Eventually looked at the source, and found that
the designer had selected (Javascript) different layouts and image sizes
for a range of different viewport sizes, and none matched my 1920x1620
screen. Hence, a blank page.

Instead, google for "fluid css layout".

Phil, London
Nov 7 '07 #3

"Randy Webb" wrote
>>>Is there a good reason why this is not so commonly done? IE am I
wasting my time?

Yes, you are wasting your time. Disable scripting and let us all know how
well it works then.
Correct me if I'm wrong but can't you have a 'no script' alternative?

---dE|_---
Nov 7 '07 #4
dE|_ wrote in
<KQ***************@newsfe7-gui.ntli.net>
"Randy Webb" wrote
>>>>Is there a good reason why this is not so commonly done? IE am I
wasting my time?

Yes, you are wasting your time. Disable scripting and let us all
know how well it works then.

Correct me if I'm wrong but can't you have a 'no script' alternative?
This isn't intended to sound as sarcastic as it might at first read but, if
you have a satisfactory 'no script' alternative, why don't you use that
instead?

--
PeterMcC
If you feel that any of the above is incorrect,
inappropriate or offensive in any way,
please ignore it and accept my apologies.

Nov 7 '07 #5

"PeterMcC" <pe***@mccourt.org.ukwrote in message
news:fg**********@energise.enta.net...
dE|_ wrote in
<KQ***************@newsfe7-gui.ntli.net>
>"Randy Webb" wrote
>>>>>Is there a good reason why this is not so commonly done? IE am I
>wasting my time?

Yes, you are wasting your time. Disable scripting and let us all
know how well it works then.

Correct me if I'm wrong but can't you have a 'no script' alternative?

This isn't intended to sound as sarcastic as it might at first read but,
if
you have a satisfactory 'no script' alternative, why don't you use that
instead?
It wouldn't be what I'm trying to achieve, it would just be better than the
blank screen I have been told I'll get if JS was disabled etc.

No insult taken my friend.

---dE|_---
Nov 7 '07 #6

"Chaddy2222"
You can solve this issue with CSS alone... Google the
"background-repeat" CSS property.

Well I've found codes on forums I was not aware of for;

background-repeat:stretch
and even
background-repeat: expand stretch-left stretch-middle stretch-right;

W3c give background-size examples for body and div but I can't get
anything
from forums or W3c working on IE7 or FF2.

Anybody got a proven CSS method?

I am aware of X, Y, and no-repeats but they do not /Fill/ the page.
Just set your BG image to a width of 100% in your CSS. That should
work.
This is what's doing my bloody head in. W3c say;

body {
background-size: auto;
background-image: url(atwork.jpg)}

I tried that with auto and various % but got nothing but the usual repeats.
I replaced with
background-width: 100% but still getting nothing on either browser. Does
anybody actually _use_ this styling?

Sick of this, hanging up the mouse for the afternoon- got some strumming to
do.

---dE|_---
Nov 7 '07 #7

"PeterMcC" <pe***@mccourt.org.ukwrote in message
news:fg**********@energise.enta.net...
dE|_ wrote in
<KQ***************@newsfe7-gui.ntli.net>
>"Randy Webb" wrote
>>>>>Is there a good reason why this is not so commonly done? IE am I
>wasting my time?

Yes, you are wasting your time. Disable scripting and let us all
know how well it works then.

Correct me if I'm wrong but can't you have a 'no script' alternative?

This isn't intended to sound as sarcastic as it might at first read but,
if
you have a satisfactory 'no script' alternative, why don't you use that
instead?
The browser's elasticy stretching of the image wouldn't be as sharp as
photoshop and I'd rather it was cast iron once determined what viewpoint it
was in.

---dE|_---
Nov 7 '07 #8
Chaddy2222 wrote on 07 nov 2007 in comp.lang.javascript:
Just set your BG image to a width of 100% in your CSS. That should
work.
How would you do that? Have you ever done that?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 7 '07 #9
dE|_ said the following on 11/7/2007 9:20 AM:
"Randy Webb" wrote
>>>>Is there a good reason why this is not so commonly done? IE am I
wasting my time?
Yes, you are wasting your time. Disable scripting and let us all know how
well it works then.

Correct me if I'm wrong but can't you have a 'no script' alternative?
If you have a non-script solution then a script solution becomes redundant.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 7 '07 #10
"dE|_" <de**@crackguitar.comwrites:
This is what's doing my bloody head in. W3c say;

body {
background-size: auto;
background-image: url(atwork.jpg)}
background-size is CSS3. Not widely implemented yet.

--
Ben.
Nov 8 '07 #11
dE|_ wrote:
>
body {
background-size: auto;
background-image: url(atwork.jpg)}

I tried that with auto and various % but got nothing but the usual repeats.
I replaced with
background-width: 100% but still getting nothing on either browser. Does
anybody actually _use_ this styling?
http://www.css3.info/preview/background-size/

It's CSS3. That page says it's currently supported by Opera 9.3, Safari
and Konqueror. (at the time it was written - there might be more now)

That's the general problem with many CSS3 features - they aren't
supported by all browsers yet.

Anahata
Nov 8 '07 #12

"Philip Herlihy" said;
Instead, google for "fluid css layout".
Somebody wants to tell that to facebook.

---dE|_---
Nov 8 '07 #13
in message <WZ***************@newsfe6-win.ntli.net>, dE|_
('d***@crackguitar.com') wrote:
I have started looking into scripts for screen size detect with the
intention of using them to pick from a number of CSS style sheets
tailored to the size.

Is there a good reason why this is not so commonly done? IE am I wasting
my time?
Principally because it's a really, really bad idea?

--
si***@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GP/CS s++: a++ C+++ ULBVCS*++++$ L+++ P--- E+>++ W+++ N++ K w--(---)
M- !d- PS++ PE-- Y+ PGP !t 5? X+ !R b++ !DI D G- e++ h*(-) r++ y+++
------END GEEK CODE BLOCK------

Nov 8 '07 #14
"dE|_" <de**@crackguitar.comwrote in
news:WZ***************@newsfe6-win.ntli.net:
I have started looking into scripts for screen size detect with the
intention of using them to pick from a number of CSS style sheets
tailored to the size.

Is there a good reason why this is not so commonly done? IE am I
wasting my time?

---dE|_---

sorta defeats the whole purpose of CSS
Nov 9 '07 #15
dE|_ wrote:
I have started looking into scripts for screen size detect with the
intention of using them to pick from a number of CSS style sheets tailored
to the size.

There's really no point.

Think about what you want to do and there's probably a CSS way to
achieve it.

What is it that you're actually trying to do?

Nov 10 '07 #16

"Richard Watson" wrote
>I have started looking into scripts for screen size detect with the
intention of using them to pick from a number of CSS style sheets
tailored
to the size.


There's really no point.

Think about what you want to do and there's probably a CSS way to achieve
it.

What is it that you're actually trying to do?
First considered for selecting a 2nd style sheet with appropriately sized
background image based on viewport detect.
This method rather than CSS stretch to avoid rubbery pixelated jpeg
stretching by the browser as it will be a sharp focused photo.

Principle; Entire picture does not have to show on a shrunk window, just be
able to fill it when maximised, and prime central content visible when
window is at a 'typical' 75%.

After the above concept I just wondered briefly whether viewport detect -
meets - CSS was something done elsewhere.

Told not, thread cut.

---dE|_---
Nov 10 '07 #17
VK
On Nov 11, 7:03 am, Randy Webb <HikksNotAtH...@aol.comwrote:
Finding the canvas size is actually pretty simple in most scenarios if
you care to read section 4.9 of the group FAQ.
Repeating your own words: "That is one perverse block of code you have
there". It might be useful 6-7 years ago with availWidth/availHeight
being a proprietary IE feature (as "screen" object itself for this
matter). There is no need of it now.

P.S. I have a fantastic DynLib library written in 1998 to use NN4/IE4
DOM features in one function call. Till now I fills my heart of proud
to see the most incompatible things working together :-) - but I'm not
pushing these forcedly sick twisted workarounds on anyone as of the
year 2007, do I?

Nov 11 '07 #18
VK said the following on 11/11/2007 3:35 AM:
On Nov 11, 7:03 am, Randy Webb <HikksNotAtH...@aol.comwrote:
>Finding the canvas size is actually pretty simple in most scenarios if
you care to read section 4.9 of the group FAQ.

Repeating your own words: "That is one perverse block of code you have
there". It might be useful 6-7 years ago with availWidth/availHeight
being a proprietary IE feature (as "screen" object itself for this
matter). There is no need of it now.
Are you saying that you see availWidth and availHeight in the group FAQ?
If you do, then you need to make sure you see version 9.88 dated
2007-10-12 as a search for those two terms turns up nothing. Or, are you
having another one of your daydreams where you are talking about
something different?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 11 '07 #19
VK
On Nov 11, 1:01 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
VK said the following on 11/11/2007 3:35 AM:
On Nov 11, 7:03 am, Randy Webb <HikksNotAtH...@aol.comwrote:
Finding the canvas size is actually pretty simple in most scenarios if
you care to read section 4.9 of the group FAQ.
Repeating your own words: "That is one perverse block of code you have
there". It might be useful 6-7 years ago with availWidth/availHeight
being a proprietary IE feature (as "screen" object itself for this
matter). There is no need of it now.
Are you saying that you see availWidth and availHeight in the group FAQ?
No, right the opposite: I do _not_ see availWidth and availHeight in
the mentioned FAQ. Habla Inglese? :-) Instead I see a convoluted code
of the time of the Browser Wars when availWidth and availHeight did
not exist anywhere ouside of IE.

Nov 11 '07 #20
VK said the following on 11/11/2007 7:03 AM:
On Nov 11, 1:01 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
>VK said the following on 11/11/2007 3:35 AM:
>>On Nov 11, 7:03 am, Randy Webb <HikksNotAtH...@aol.comwrote:
Finding the canvas size is actually pretty simple in most scenarios if
you care to read section 4.9 of the group FAQ.
>>Repeating your own words: "That is one perverse block of code you have
there". It might be useful 6-7 years ago with availWidth/availHeight
being a proprietary IE feature (as "screen" object itself for this
matter). There is no need of it now.
>Are you saying that you see availWidth and availHeight in the group FAQ?

No, right the opposite: I do _not_ see availWidth and availHeight in
the mentioned FAQ.
Your sentence implied that you did. Otherwise, the "There is no need of
it now" seems misguided.
Habla Inglese? :-) Instead I see a convoluted code of the time of the
Browser Wars when availWidth and availHeight did not exist anywhere
ouside of IE.
"Convoluted code"? I agree that the IE4 code could be removed. In fact,
the NN4 code could probably be removed as most versions of IE/NN that
fall into those categories that are used on the web support the "in
modern browsers" category with a few exceptions. Even as "convoluted" as
you call it, the code in the FAQ is over-simplified as it doesn't even
work - correctly - in some "modern browsers".

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 11 '07 #21
In uk.net.web.authoring message <PZ*********************@giganews.com>,
Sat, 10 Nov 2007 23:03:27, Randy Webb <Hi************@aol.composted:
>
Finding the canvas size is actually pretty simple in most scenarios if
you care to read section 4.9 of the group FAQ.
The FAQ of this newsgroup has AFAICS no section 4.9. TBYW.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Nov 11 '07 #22
Dr J R Stockton said the following on 11/11/2007 4:00 PM:

<follow-up set to comp.lang.javascript>
In uk.net.web.authoring message <PZ*********************@giganews.com>,
Sat, 10 Nov 2007 23:03:27, Randy Webb <Hi************@aol.composted:
>Finding the canvas size is actually pretty simple in most scenarios if
you care to read section 4.9 of the group FAQ.

The FAQ of this newsgroup has AFAICS no section 4.9.
Then you need to learn to read plain English and how to find an FAQ.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 12 '07 #23
In uk.net.web.authoring message <Mv*********************@giganews.com>,
Sun, 11 Nov 2007 19:36:29, Randy Webb <Hi************@aol.composted:
>Dr J R Stockton said the following on 11/11/2007 4:00 PM:

<follow-up set to comp.lang.javascript>
>In uk.net.web.authoring message <PZ*********************@giganews.com>,
Sat, 10 Nov 2007 23:03:27, Randy Webb <Hi************@aol.composted:
>>Finding the canvas size is actually pretty simple in most scenarios if
you care to read section 4.9 of the group FAQ.
The FAQ of this newsgroup has AFAICS no section 4.9.

Then you need to learn to read plain English and how to find an FAQ.
No; but you need to pay more attention to the exact meaning, if any, of
"this" in the current context, and to where your article is actually
going.

Jim : Have you a URL for the most recent unwa FAQ?

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 12 '07 #24
On Nov 7, 9:57 am, "dE|_" <d...@crackguitar.comwrote:
I have started looking into scripts for screen size detect with the
intention of using them to pick from a number of CSS style sheets tailored
to the size.

Is there a good reason why this is not so commonly done? IE am I wasting my
time?
I see further down this thread you have quite a specific thing you'd
like to do... but I'm going to ignore that!

Web developers are seldom as smart as they think they are. Whenever
they try to do something clever that takes into account all variables,
they mess things up because there's some variable (if not more) that
they haven't thought of.

Potential problems with coding based on "size" include:
1. the user might not have their browser maximised
2. you don't know how much chrome the browser is using
3. you don't know if the user is currently displaying optional
components such as Firefox's sidebar
4. if the user is currently displaying optional components such as
Firefox's sidebar, you don't know how wide they've decided to have it
display
5. you don't know what text size the user has selected as their
default
6. you don't know if the user will change the size of their browser's
window *while visiting your site*
7. if the user is currently displaying optional components such as
Firefox's sidebar, you don't know if they're going to change its width
*while visiting your site*
8. you don't know if the user has JavaScript enabled
9. scrollbars are different widths in different browsers on the same
system
10. some users will have more than one screen
11. opening pages in the background can change the height available
for your site in Firefox because another row is needed for the extra
tabs
12. different platforms will affect the exact measurements of most of
the above items

I'm sure there are quite a few more that I've not thought of!
Unfortunately, you'd have to think of them all as well...
--
AGw.

Nov 14 '07 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Michael Hill | last post by:
I have a perl script that i use to render a html page. In that page i call out a stylesheet. If the user has a 800x600 display the fonts are really too big. Since screen resolution is a function...
3
by: Marti | last post by:
Dear everyone, Its my understanding that IE6 now uses a default text-size of "Small" rather than IE5's "Medium". Since I have used relative font-sizes (usually in ems) on all my sites, I am...
5
by: Chris | last post by:
After exhausting my search on the MS website, I can't find a straight answer. I fin dit hard to believe that MS left our something so useful in ASP.NET as screen resolution detection. Problem:...
1
by: BillZondlo | last post by:
Can someone look at this and tell me why, when I call this from my main app, it displays fine (fades form in and out) but then before my main app displays, I see other dialog boxes flash...
7
by: Robert Bull | last post by:
I have created an asp.net app on my machine where the resolution is set to 1280 x 1024. When my users view the form on their screen, some of the controls display differently than on my screen. One...
3
by: Chris | last post by:
I think I placed this in the wrong news group so I'm moving it here. Suggestion to Microsoft make the categories more clear and make better sense. ASP.NET should be its own group, why bury under...
3
by: What-a-Tool | last post by:
I recently created an application on my 19" monitor - looked good. Tried running it on a 17 inch monitor - didn't look so good anymore. Is there a way that monitor resolution/screen size can be...
5
by: Maxi | last post by:
I have a 30X16 cells table in my html page. Table height and width are set to 100%. I have set size of every cell inside the table to 24 pixel. When I open the html page in maximize state in...
2
by: ultraviolet2006 | last post by:
Hi folks! I have a question: I am Designing a Wap Site Using XHTML-MP Language,CSS and ASP (Active Server Page), the Problem is how to detect the Screen Size of the Mobile Visiting the site, so as...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.