473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use script in <head> ?

<head>
<meta http-equiv="content-type" content="text/html;charset=is o-8859-1">
<title>Home Page</title>
<!--[if IE 6]>
<style#navlis t 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.htm l">Home Page</a>
<li><a href="index.htm l">Menu Item 01</a>
<li><a href="index.htm l">Menu Item 02</a>
<li><a href="index.htm l">Menu Item 03</a>
<li><a href="index.htm l">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 3075
"deko" <de**@nospam.co mwrote:
<head>
<meta http-equiv="content-type" content="text/html;charset=is o-8859-1">
<title>Home Page</title>
<!--[if IE 6]>
<style#navlis t 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 "conditiona l 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.infosystem s.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 "conditiona l 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.c ss" />
<![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.c ss" />
<![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.c ss" />
<![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.c ss" />
<![endif]-->

is, IMHO, the cleanest and most effective way to manage the display
peculiaritie s 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
2144
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 can I add an attribute to the <BODY> ? I need to assign a function on the onLoad attribute of the body... how
7
5532
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> <script>document.writeln("<div id='mydiv'>stuff</div>");</script> </head> <body>blah</body>
3
2290
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 = document.createElement("a");
6
5450
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 the page dynamically when the page is rendered? -- ----------------------------------- Ken Varn Senior Software Engineer Diebold Inc.
3
2653
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
393
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 is to assign a runat="server" and an id="myheader" attribute to the HEAD-Tag. On the code behind I've defined a variable Protected myHeader As...
3
4254
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
1396
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 seems Render only sends items into the <BODY>. Actually, it would be nice if I had control over the entire rendering process, including the whole...
7
12959
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 this to access the header: In the master page: <HEAD runat="server"> In the aspx page: Page_Load
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.