473,320 Members | 2,088 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.

How to use script in <head> ?

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Home Page</title>
<!--[if IE 6]>
<style#navlist a { height: 1em; } </style>
<![endif]-->
</head>

Is the [ if / else ] statement above JavaScript? If not, what kind of script is
it?

The problem this solves is border spacing - IE will render differently than FF -
when using a list like this:

<div id="navlist">
<ul>
<li><a href="index.html">Home Page</a>
<li><a href="index.html">Menu Item 01</a>
<li><a href="index.html">Menu Item 02</a>
<li><a href="index.html">Menu Item 03</a>
<li><a href="index.html">Contact Us</a>
</ul>
</div>
Here is the CSS for the navlist:

#navlist a {
background-color:none;
display:block;
padding:8px 2px 8px 10px;
border-style:none none solid;
border-width:medium medium 1px;
border-color:#333333;
}

#navlist {
width:120px;
margin-bottom:20px;
}

#navlist ul {
margin:0;
padding:0;
list-style-type:none;
}

#navlist li {
margin:0;
}

Where can I learn more about the type of script used in my example?

Oct 14 '06 #1
8 3066
"deko" <de**@nospam.comwrote:
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Home Page</title>
<!--[if IE 6]>
<style#navlist a { height: 1em; } </style>
<![endif]-->
</head>

Is the [ if / else ] statement above JavaScript? If not, what kind of script is
it?
A proprietary MS construct called "conditional comment":
http://msdn.microsoft.com/workshop/a...omment_ovw.asp

There are various ways to feed different CSS to IE and to proper
browsers. Each method has it's own positives and negatives. Search an
appropriate group (not this one since it is about HTML, try
comp.infosystems.www.authoring.stylesheets) or the web for a rundown.
>The problem this solves is border spacing - IE will render differently than FF -
when using a list like this:
[code snipped]

Don't post code, post a url instead.

Another way to fix this IE bug is to add "zoom:1" to the "#navlist a"
rule.

--
Spartanicus
Oct 15 '06 #2
A proprietary MS construct called "conditional comment":
http://msdn.microsoft.com/workshop/a...omment_ovw.asp
Ah, I see. Conditional Comments sound like a good way to go - just use a
separate stylesheet for IE, like this:

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="iestyle.css" />
<![endif]-->

From what I've read, this is a reliable solution.

Still, dealing with IE is a chore. My guess is MS purposely left IE an ugly
mess so other browsers (FF, Opera) would gain market share and leave them less
vulnerable to lawsuits. They are certainly capable of making IE standards
compliant, but have chosen not to.

Whenever the question of "why didn't they ..." comes up, the answer is usually
money.

Oct 15 '06 #3
deko wrote:
Ah, I see. Conditional Comments sound like a good way to go - just use a
separate stylesheet for IE, like this:
I do this, but it only has one line in it - to approximately fix font
sizes for high-res screens with large font display. Even this much I
really dislike using.

What do people think belongs in an "IE only" stylesheet? What's
justifiable to put in there?

Oct 16 '06 #4
Andy,
What do people think belongs in an "IE only" stylesheet? What's
justifiable to put in there?
I´m afraid we are going to needit, if IE7 comes along!
How to make something which uses the new opportunities of IE7, without
losing the IE6 users?

Johan
http://www.web.garden.be
Andy Dingley wrote:
deko wrote:
Ah, I see. Conditional Comments sound like a good way to go - just usea
separate stylesheet for IE, like this:

I do this, but it only has one line in it - to approximately fix font
sizes for high-res screens with large font display. Even this much I
really dislike using.

What do people think belongs in an "IE only" stylesheet? What's
justifiable to put in there?
Oct 16 '06 #5

Jobe wrote:
What do people think belongs in an "IE only" stylesheet? What's
justifiable to put in there?

I´m afraid we are going to needit, if IE7 comes along!
Why?

It's the same web, so why should a new and hopefully better browser
need even more hacks? I think our difference here is that I see a
browser specific stylesheet as an abomination to be tolerated if
unavoidable, you're seeing it as a channel to go in even more weird
IE-only directions.
How to make something which uses the new opportunities of IE7, without
losing the IE6 users?
I don't want new "opportunities", I want the old bugs dead.

Oct 16 '06 #6
How to make something which uses the new opportunities of IE7, without
losing the IE6 users?
>I don't want new "opportunities", I want the old bugs dead.
Agreed. But until MS chooses to make IE standards compliant, web developers
have to deal with it.

What I like about Conditional Comments is that only IE reads them (a supposedly
reliable feature of IE, including IE7). So there is no additional overhead.
The size of a standards-compliant stylesheet is not bloated with IE hacks, and
visitors smart enough to use standards-compliant browsers are not penalized in
any way.

So, maintaining an IE-specific stylesheet like this:

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="iestyle.css" />
<![endif]-->

is, IMHO, the cleanest and most effective way to manage the display
peculiarities of IE. An iestyle.css can contain every hack and workaround to
accommodate each IE version (all the way back to IE 5), all cordoned off the
side, where they belong.

Oct 16 '06 #7
VK
deko wrote:
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="iestyle.css" />
<![endif]-->

is, IMHO, the cleanest and most effective way to manage the display
peculiarities of IE.
Full ACK.

Just to make the picture complete: IE's conditional comments have two
forms of syntax:
1) content revealing - which you used
2) content hiding

<!--[if IE]>
<p>This part will be parsed by IE</p>
<![endif]-->

<![if !IE]>
<p>This part will be skipped by IE parser</p>
<![endif]>

The content hiding syntax makes the validator all upset and grunchy :-)
so it never went into wide use. Yet a thing to mention.

Both forms (content revealing and content hiding) allows major.minor
version check as well:

<!--[if lt IE 6]>
<p>This Internet Explorer is older than v6 (so some 5.x)</p>
<![endif]-->

<!--[if gte IE 6]>
<p>This Internet Explorer is v6 or higher</p>
<![endif]-->

<!--[if IE 7.0]>
<p>This browser is Internet Explorer 7.0 (first official release).</p>
<![endif]-->

Oct 26 '06 #8
deko wrote:
><!--[if IE]>
<link rel="stylesheet" type="text/css" href="iestyle.css" />
<![endif]-->

is, IMHO, the cleanest and most effective way to manage the display
peculiarities of IE.

Full ACK.

Just to make the picture complete: IE's conditional comments have two
forms of syntax:
1) content revealing - which you used
2) content hiding

<!--[if IE]>
<p>This part will be parsed by IE</p>
<![endif]-->

<![if !IE]>
<p>This part will be skipped by IE parser</p>
<![endif]>

The content hiding syntax makes the validator all upset and grunchy :-)
so it never went into wide use. Yet a thing to mention.

Both forms (content revealing and content hiding) allows major.minor
version check as well:

<!--[if lt IE 6]>
<p>This Internet Explorer is older than v6 (so some 5.x)</p>
<![endif]-->

<!--[if gte IE 6]>
<p>This Internet Explorer is v6 or higher</p>
<![endif]-->

<!--[if IE 7.0]>
<p>This browser is Internet Explorer 7.0 (first official release).</p>
<![endif]-->
Thanks for the clarification.

Maintaining multiple stylesheets for different versions of IE (in addition to my
primary standards-compliant stylesheet) is pain, but still easier than any other
solution I've found.

I have not had to do anything IE 7 specific yet but, from I've read, I may need
to at some point. The stuff in my IE 6 stylesheets is mainly to deal with float
weirdness and adjustment of height, margins or padding.

Oct 27 '06 #9

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

Similar topics

0
by: Andrés Giraldo | last post by:
Hi! It's possible to register some script between the <head> and </head> actually I'm Using RegisterStartupScript and RegisterClientBlockScript, but it works on the body By the way... how...
7
by: Ignac Vucko | last post by:
Is writing a document *during* page load safe and supported for all 4th and 5th generation browsers? If not, can you show me a specific example/browser where it causes problems? <html> <head>...
3
by: francescomoi | last post by:
Hi. I'm trying to insert some text between <head> and <body> but I'm not able. I try with: -------- bodyPoint = document.getElementsByTagName('body'); var myLink =...
6
by: Ken Varn | last post by:
I want to add my own custom <STYLE> section in the <HEAD> section of my ASP.NET page within a custom control. Can someone tell me how I can have my custom control add tags to the <HEAD> section of...
3
by: jsh02_nova | last post by:
Anybody know how to add a script block to the html <head> section programmatically without using the 'RegisterScriptBlock' functions? -- thx -jsh
1
by: MBO | last post by:
Hello NG, I'm writing a control that needs to put a clientside javascript between the <HEAD> Tags of a webpage where it is placed on. I've seen from other threads in this NG, that one solution...
3
by: thomasamillergoogle | last post by:
Is it possible that my user control can add code to the HEAD of the parent page that hosts the control?
3
by: PJ6 | last post by:
I want to render this text into the <HEAD> section of a page (and perhaps mute any existing title declaration, or alter it to be this instead) - <title runat="server" id=HtmlTitle></title> It...
7
by: ericgla | last post by:
I am creating a web app using asp.net 2.0 where all pages are based a single master page. On some of the aspx pages I need to add javascript to the head tag in order to use Google maps. I tried...
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
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: 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: 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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.