473,322 Members | 1,345 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,322 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 2038
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: 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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.