473,245 Members | 1,750 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,245 software developers and data experts.

How to give rules for choosing style sheets?

I want a device to use styles given for media type handheld and not the
styles given for media type screen, if the device supports media types
handheld and screen. Is it possible without writing all styles specified
for screen again for handheld?

--
Homepage http://www.iki.fi/jarno.suni/
Mar 12 '06 #1
12 2034
On Sun, 12 Mar 2006 20:11:49 +0100, Jarno Suni <lo**@signature.invalid>
wrote:
I want a device to use styles given for media type handheld and not the
styles given for media type screen, if the device supports media types
handheld and screen. Is it possible without writing all styles specified
for screen again for handheld?


Why not use three stylesheets then:
1. one generic with the styles you want both devices (screen and handheld)
to use, and refer to them with media 'all';
2. one specifically for screens, referring to them with media 'screen'
(possibly 'projection' too?);
3. the last one specifically for handhelds, referring to them with media
'handheld'.

Will that do?

See also <URL:http://www.w3.org/TR/REC-CSS2/media.html>

--
______PretLetters:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 12 '06 #2
Barbara de Zoete wrote:
Will that do?
Not well, because some handheld devices support both 'handheld' and
'screen', but I want to give totally different style for bigger 'screen'
devices, such as desktop PCs.
See also <URL:http://www.w3.org/TR/REC-CSS2/media.html>


Thanks, but I do not see how I could tell a device to use a sheet, if it
supports 'screen', but does not support 'handheld'.

--
Homepage http://www.iki.fi/jarno.suni/
Mar 12 '06 #3
Barbara de Zoete wrote:
Will that do?
Not well, because some handheld devices support both 'handheld' and
'screen', but I want to give totally different style for bigger 'screen'
devices, such as desktop PCs.
See also <URL:http://www.w3.org/TR/REC-CSS2/media.html>


Thanks, but I do not see how I could tell a device not to use 'screen'
styles, if it also supports 'handheld' styles.

--
Homepage http://www.iki.fi/jarno.suni/
Mar 12 '06 #4
On Sun, 12 Mar 2006 21:38:12 +0100, Jarno Suni <lo**@signature.invalid>
wrote:
Barbara de Zoete wrote:
Will that do?


Not well, because some handheld devices support both 'handheld' and
'screen', but I want to give totally different style for bigger 'screen'
devices, such as desktop PCs.


Put the <link> to the handheld.css last in the head of your page.

--
______PretLetters:
| weblog | http://www.pretletters.net/weblog/weblog.html |
| webontwerp | http://www.pretletters.net/html/webontwerp.html |
|zweefvliegen | http://www.pretletters.net/html/vliegen.html |
Mar 12 '06 #5
Barbara de Zoete wrote:
Put the <link> to the handheld.css last in the head of your page.


Yes, I have done that. But, I have to remember to overwrite screen.css'
specifications in handheld.css. This makes it a little bit tricky to
maintain.

--
Homepage http://www.iki.fi/jarno.suni/
Mar 12 '06 #6
...and the handheld device downloads the screen.css for nothing.

--
Homepage http://www.iki.fi/jarno.suni/
Mar 12 '06 #7
Jarno Suni wrote:
Barbara de Zoete wrote:
Put the <link> to the handheld.css last in the head of your page.


Yes, I have done that. But, I have to remember to overwrite screen.css'
specifications in handheld.css. This makes it a little bit tricky to
maintain.


Welcome to the world of catch 22s. The handheld manufacturer probably set
up their device to accept media type screen due to a general lack of
websites supporting the handheld media type. Now we are faced with
additional work to handle the situation.

To the best of my knowledge, you are stuck with having to rewrite the entire
style sheet for the second media type.

Carolyn
--
Carolyn Marenger

Mar 13 '06 #8
Carolyn Marenger wrote:
To the best of my knowledge, you are stuck with having to rewrite the entire
style sheet for the second media type.


Couldn't W3C add a way to exclude a style to the recommendation, if
device supports some media type:
e.g.
<LINK rel="stylesheet" type="text/css"
media="screen, -handheld" href="real_screen.css">
would give order to use real_screen.css, if device supports 'screen' AND
does NOT support 'handheld'. This wouldn't help the users of old
browsers. BTW Can you update the browser of old mobile phone?

--
Homepage http://www.iki.fi/jarno.suni/
Mar 13 '06 #9
Jarno Suni wrote:
..and the handheld device downloads the screen.css for nothing.

... which would cost some extra money & time to someone who is browsing.

--
Homepage http://www.iki.fi/jarno.suni/
Mar 13 '06 #10
Jarno Suni wrote:
Carolyn Marenger wrote:
To the best of my knowledge, you are stuck with having to rewrite the
entire style sheet for the second media type.


Couldn't W3C add a way to exclude a style to the recommendation, if
device supports some media type:
e.g.
<LINK rel="stylesheet" type="text/css"
media="screen, -handheld" href="real_screen.css">
would give order to use real_screen.css, if device supports 'screen' AND
does NOT support 'handheld'. This wouldn't help the users of old
browsers. BTW Can you update the browser of old mobile phone?


The answer to that is possibly. If you want it, contact w3c and get on
their advisory panel, or at least recommend it to them stating your
justifications. It still becomes an issue for the browser writers to deal
with. Regardless what the standard is, they can always decide to ignore
it. Ultimate decision would probably be based on their sales.

Updating browsers in mobile phones? Contact the manufacturer for that. My
guess is they won't bother, since their focus seems to be make a new model
with new features and sell it to everyone who bought the old and outdated
model. Logical does not always equate with making money.

Carolyn
--
Carolyn Marenger

Mar 13 '06 #11
Jarno Suni wrote:
Jarno Suni wrote:
..and the handheld device downloads the screen.css for nothing.

.. which would cost some extra money & time to someone who is browsing.


Blame the hand-held browser makers for accepting screen media in the
first place. I don't know what they were thinking...

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Mar 14 '06 #12
Carolyn Marenger wrote:
To the best of my knowledge, you are stuck with having to rewrite the
entire style sheet for the second media type.


I got an idea from the HTML 4.01 Specification, Chapter 14 [1] and tried
to define two preferred style sheets inside <head> section:
<link rel="stylesheet" type="text/css" title="pref" media="handheld"
href="handheld.css" />
<link rel="stylesheet" type="text/css" title="pref" media="screen"
href="screen.css" />

According to the chapter 14.4.1: "Both LINK and STYLE may be used with
the media attribute. The user agent is then responsible for filtering
out those style sheets that do not apply to the current medium." On the
other hand, a standard handheld medium should not use screen.css, if it
supports handheld media type, since in chapter 14.3.2 it is told that
"If two or more LINK elements specify a preferred style sheet, the first
one takes precedence."

Unfortunately, the XHTML browser of the mobile phone I use, does not
follow these rules; it uses both style sheets. I tried to change the
title of the second link tag, but it did not help; in the contrary
Firefox 1.5 uses neither of the style sheets then.

[1] http://www.w3.org/TR/html4/present/styles.html

--
Homepage http://www.iki.fi/jarno.suni/

Mar 14 '06 #13

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

Similar topics

3
by: Phil Thompson | last post by:
does it matter in which order i place different style sheets i.e. <link rel="stylesheet" type="text/css" media="screen" href="style/screen.css" /> <link rel="stylesheet" type="text/css"...
7
by: Marek Mänd | last post by:
When using <TABLE rules="all"> Mozilla 1.6 and previous versions draw a nasty interiour border, which doesnt go away though I have on TD's css border:none set. Is it something wrong with my...
12
by: relaxedrob | last post by:
Hi All! I have a page with with the following style information: <link rel="stylesheet" type="text/css" href="/eEmployment/eTech.css" /> <style type="text/css"> DIV.Application {...
9
by: Radium | last post by:
Cascading Style Sheet is an extreme hazard to your privacy. It allows others on the internet to see your monitor and files. It allows them to copy images on your monitor to their computers. It...
1
by: mscertified | last post by:
Can anyone explain how references to style sheets work, I've exhausted looking in help, its all so confusing. I have three style sheets in my project under 'Style Sheets'. Only the first style...
8
by: sourpatchkid | last post by:
Hello, If you have a main style sheet (main.css) that imports, let's say, 2 others, like so: @import url(first.css); @import url(second.css); would anything on first.css override repeated...
3
by: dennis.sprengers | last post by:
* I'm trying to work out some rewrite rules that should do the following: case 1: a request to mysite.com: rewrite http://www.mysite.com/files/sheets.ppt to...
3
by: Markus | last post by:
Hello While googling for this topic I found lots of advice on how to use @media rules to _hide_ stuff from Mac IE. Anyway, actually _using_ @media to write media specific CSS for both Win and...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a machine running IIS 6.0. I just replaced the web.config and several aspx pages in the application and now the style sheets are not working. the images from the themes work but not the css...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.