473,398 Members | 2,125 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,398 software developers and data experts.

Curious style

Hi All,

I found this in a page I was looking at and am wondering what does the
slash in the second width do? Is this valid css? This technique was used
in several places in the style sheet.
Another example is: font: 78%/1.5 arial, helvetica, serif;

Patrick

#nav a {
display: block;
width: 10em;
w\idth: 6em; <------ That
color: #7C6240;
text-decoration: none;
padding: 0.25em 2em;
}
--
Patrick A. Smith Assistant System Administrator
Ocean Circulation Group – USF - College of Marine Science
http://ocgweb.marine.usf.edu Phone: 727 553-3334

The trouble with doing something right the first time is that nobody
appreciates how difficult it was. - La Rochefoucauld
Mar 1 '07 #1
8 2277
Patrick Smith <ps****@marine.usf.eduwrote:
>I found this in a page I was looking at and am wondering what does the
slash in the second width do? Is this valid css? This technique was used
in several places in the style sheet.

#nav a {
display: block;
width: 10em;
w\idth: 6em; <------ That
padding: 0.25em 2em;
}
IE5 doesn't understand CSS character escaping so it doesn't realise
that w\idth is the same as width.

Hence IE5 with its broken box model sees width: 10em; padding: 0.25em
2em; where the 2em is placed inside the 10em.
Other browsers see width: 6em; padding: 0.25em 2em; where the 2em is
correctly placed outside the 6em.
So both browsers display the same.
>Another example is: font: 78%/1.5 arial, helvetica, serif;
In the fort shorthand you can use either font-size or
font-size/line-height.

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net <http://steve.pugh.net/>
Mar 1 '07 #2
Scripsit Patrick Smith:
I found this in a page I was looking at and am wondering what does the
slash in the second width do?
The idea with
width: 10em;
w\idth: 6em;
is that faulty browsers that apply a wrong box model (read: old IE versions
and newer IE versions in "quirks" mode) are supposed to fail to understand
the latter, leaving the former in force. Conforming browsers process both,
treating \i as identical with i.

It's one of the many hacks to deal with faulty browsers. Hacks often fire
back as browsers change. Why shouldn't faulty browsers be allowed to display
a page poorly? That's part of their being faulty, after all. The situation
was different when IE 5 was common, but how long are we going to serve it?
Is this valid css?
The snippet you posted is "valid" - syntactically correct - CSS, except for
for added text "<------ That". You can use
http://jigsaw.w3.org/css-validator/#validate-by-input
to check such things out quickly.
Another example is: font: 78%/1.5 arial, helvetica, serif;
What about it? Any CSS reference tells you what it means. It is more or less
clueless, though, since it probably sets the overall font size to 78% of the
value selected by the user and the line-height to an excessively large value
(1.3 is OK for Arial). It also has arial and helvetica in a wrong order - if
both are available, Helvetica probably looks better than its Microsoft
clone, Arial. The final bogosity is making serif the fallback after listing
down two sans-serif fonts.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Mar 1 '07 #3
In article <es*********@news1.usf.edu>,
Patrick Smith <ps****@marine.usf.eduwrote:
Hi All,

I found this in a page I was looking at and am wondering what does the
slash in the second width do? Is this valid css? This technique was used
in several places in the style sheet.
Another example is: font: 78%/1.5 arial, helvetica, serif;

Patrick

#nav a {
display: block;
width: 10em;
w\idth: 6em; <------ That
color: #7C6240;
text-decoration: none;
padding: 0.25em 2em;
}
It is a way of talking to some browsers like some IE (which
recognise escape characters) and not others (which ignore the ill
understood construction). So, in above, the good Firefox will use
10em and ignore the attempt to overide in the next width
specification. IE will read and note both, using the last 6em as
it overrides the 10em.

--
dorayme
Mar 1 '07 #4
dorayme wrote...
Patrick Smith <ps****@marine.usf.eduwrote:
>#nav a {
display: block;
width: 10em;
w\idth: 6em; <------ That
color: #7C6240;
text-decoration: none;
padding: 0.25em 2em;
}
It is a way of talking to some browsers like some IE (which
recognise escape characters) and not others (which ignore the ill
understood construction). So, in above, the good Firefox will use
10em and ignore the attempt to overide in the next width
specification. IE will read and note both, using the last 6em as
it overrides the 10em.
Isn't that the opposite of what Steve and Jukka have just said?
I'm confused!
--
Martin Clark
Mar 1 '07 #5
In article <bF**************@getta.life>,
Martin Clark <ma****@spl.atwrote:
dorayme wrote...
Patrick Smith <ps****@marine.usf.eduwrote:
#nav a {
display: block;
width: 10em;
w\idth: 6em; <------ That
color: #7C6240;
text-decoration: none;
padding: 0.25em 2em;
}
It is a way of talking to some browsers like some IE (which
recognise escape characters) and not others (which ignore the ill
understood construction). So, in above, the good Firefox will use
10em and ignore the attempt to overide in the next width
specification. IE will read and note both, using the last 6em as
it overrides the 10em.
Isn't that the opposite of what Steve and Jukka have just said?
I'm confused!
Don't be, if in doubt, rule of thumb, believe them.

I recall reading once that IE in non quirks mode will read and
follow w\idth.

Anyway, you better research the details. Was just meaning to let
you know generally what it was about as you seemed totally
puzzled.

Take a look at

<http://css-discuss.incutio.com/?page=BoxModelHack>

(As it happens, whenever I feel the need to use these things, I
look it all up to get it roughly right. But I try to avoid
designs that depend on such things. I don't know if you want to
know this!)

--
dorayme
Mar 1 '07 #6
dorayme wrote...
>In article <bF**************@getta.life>,
Martin Clark <ma****@spl.atwrote:
>
Isn't that the opposite of what Steve and Jukka have just said?
I'm confused!

Don't be, if in doubt, rule of thumb, believe them.
But I believe you, too! I am in awe of extra-terrestrial usenet beings!
>I recall reading once that IE in non quirks mode will read and
follow w\idth.

Anyway, you better research the details. Was just meaning to let
you know generally what it was about as you seemed totally
puzzled.
Not me, mate. My reply was my first post in this thread. I don't say
very much in these groups. I am more of a compulsive lurker. Are
Martians able to detect the thoughts of usenet lurkers, perhaps?
>Take a look at

<http://css-discuss.incutio.com/?page=BoxModelHack>

(As it happens, whenever I feel the need to use these things, I
look it all up to get it roughly right. But I try to avoid
designs that depend on such things. I don't know if you want to
know this!)
Yes, I am aware of the box model stuff and, like you, try to avoid
designs where this would be critical. I can't help thinking that hacks
are all very well, but that they are not very future-proof. I understand
that there are a number of IE hacks that do not work with IE7. I did not
pay attention to which ones these were, as I don't use them.
--
Martin Clark
Mar 2 '07 #7
Scripsit dorayme:
I recall reading once that IE in non quirks mode will read and
follow w\idth.
It seems that IE 6 and IE 7 read and follow it in either mode, so you cannot
really simulate IE 5 just by making them work in quirks mode. In quirks
mode, you get the wrong box model but you still have correct parsing that
reads w\idth as width.

This means that in order to test that the hack is of any use in some
particular situation, you would need a real IE 5 along with a newer version.
http://css-discuss.incutio.com/?page=BoxModelHack
Looks a bit dusty. Most of those contrived hacks would best be forgotten,
since they struggle with fairly old browser versions and involve (largely
unpredictable) risks with _new_ versions. Anyone who still uses IE 5 should
be prepared to see pages more or less poorly formatted, in an increasing
amount. Maybe they should install the favelet that turns CSS off entirely.
:-)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Mar 2 '07 #8
In article <aE**************@getta.life>,
Martin Clark <ma****@spl.atwrote:
Anyway, you better research the details. Was just meaning to let
you know generally what it was about as you seemed totally
puzzled.
Not me, mate. My reply was my first post in this thread. I don't say
very much in these groups.
OK, sorry, but you get the drift...

[btw, be shy no longer, speak up Martin! I will defend you
against all vicious attacks, they are sending me a bodyguard
contingent because of my many earthling enemies and they (my
minders) always lean towards the hysterical overkill and there
will be many to spare for you. It will be like a whole army
division (remember Saddam's Republican Guard anyone?) <g>

--
dorayme
Mar 2 '07 #9

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

Similar topics

35
by: Stan Milam | last post by:
The following code implements a strcat-like function which can receive a variable number of arguments. I thought it would be faster if I kept a pointer to the end of the string as it is built so...
7
by: tshad | last post by:
I was curious if there is some reason why you don't need the "then" in the if test of VB.Net or is it just ASP.NET. I just noticed that I don't really need to explicitly put the word "then" as...
1
by: Phill. W | last post by:
I understand how to use the IExtenderProvider Interface to add a "dynamic" property to a Control, but is there any equivalent "mechanism" for using this extendability with just /any-old/ class,...
3
by: CoreyWhite | last post by:
I wrote a program that shows some incredibly curious probabilities. It is a simple game where you guess a number between 0 and 2 that the computer thinks up. What is origonal about this game is...
6
by: rongchaua | last post by:
Hi all, I want to change the style of a button. But I don't know how to do it. For example, I have already a button OK on form. I want to add these styles to this button (WS_CHILD || WS_VISIBLE ||...
1
by: titch | last post by:
A curious problem I've encountered which can be seen with a simple piece of HTML: <div id="a" style="position: absolute; top:5px; left: 5px; width:100px; height:100px; border: 1px solid red;">...
34
by: chandu | last post by:
Hello every body , upto now i saw advantages of C# only,i am curious about what are the disadvantages of C#..(because any programming language should have some positives and negatives..) Thanks...
6
by: =?Utf-8?B?TWljaGVsIFBvc3NldGggW01DUF0=?= | last post by:
Hello i just encountered a funny situation Dim i As Integer = 0 MsgBox(i = Nothing) and
11
by: Liz | last post by:
anyone have any idea why there have been (at least) 82 VS 2008 post-release messages here on the C# board but only 5 on the VB.NET board; are the VB crowd just not interested?? strikes me as a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.