This was a complete shock to me recently, even after years of ‘assuming’ that something this simple would be well supported… after all, this is pretty basic.
All modern browsers Mozilla (Firefox), Safari, Opera, even old Netscape (eg: 4.x) browsers work properly with the following code and comply with the W3C HTML specification making the value “Two” unable to be selected by the user within the browser… MSIE doesn’t comply and allows the user to select it!
<form name="example" action="#" method="get">
<option value="2" disabled="disabled">Two</option>
<option value="3" selected="selected">Three</option>
<option value="4" style="color:green;">Four</option>
This ‘failure’ to support standards actually seems to be due to the way the <select> tag is handled by the browser… it passes off control to the operating system (Windows). Obviously, Microsoft was able to pass along ‘other’ attributes, like ‘style’ in the example above, but chose to not support ‘disabled’.
NOTE: Tested on MSIE 6.0 (WinXP), hopefully Microsoft will fix this in MSIE7.
CSS = Cascading Style Sheets, this is done primarily to externalize the ‘look and feel’ of a web page from the actual ‘data’ being presented.
There are several ways to do this…
1. External file (most common)… add the following to the
<head> section of your page:
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" type="text/css" href="/filename.css" media="all" />
2. Inline (usually in the
<head> section of every page):
<style type="text/css" media="screen">
... // some stuff here.
3. Inline (on individual tags):
<div style="color:red;">Red text</div>
1. Media types (common – though others exist!):
2. Guideline: always use lowercase names in your CSS, MUST start with an alpha (not numeric).
The !DOCTYPE directive is one of the most commonly misunderstood parts of markup in the entire page, additionally, most WYSIWYG editors get it wrong.
This serves two major purposes, with one common goal – ‘standards’!
1. Validators can easily look to the markup to determine which version of the HTML/XHTML standard to validate against (actually, it’s done against the DTD that you define within the tag).
2. Browsers also use this tag to determine which version of the HTML/XHTML standard to render with… however, the most common browser currently on the market (MSIE), chooses to ignore it!
3. Other markup languages (decendent of SGML, like HTML and XHTML) like WML also use this tag.
1. This tag doesn’t follow standard XML rules, there is NO close tag, but it’s not self-closing either.
2. This MUST be the very first line of output in your HTML.
3. Because of the MSIE issue, you cannot start your page with:
<?xml version="1.0"?> for XML!
Some common examples:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
If you’ve taken some time to wander around my site, you may have noticed that I also have SSL enabled (with https://www.giantgeek.com/ url’s). Here’s the steps you can take on your site/server – provided you have proper access.
Download and install Apache-OpenSSL and OpenSSL – I’ve found http://hunter.campbus.com/ to be a reliable source for precompiled binaries for Win32 platforms.
Install OpenSSL, and add the following environmental variable.
Generate a private key:
openssl genrsa —des3 —out filename.key 1024
Create CSR Request…
openssl req —new —key filename.key —out filename.csr
This step will ask for several pieces of information, here’s my example:
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Illinois
Locality Name (eg, city) :Carol Stream
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Dean Scott Fredrickson
Organizational Unit Name (eg, section) :Giant Geek Communications
Common Name (eg, YOUR name) :www.giantgeek.com
Email Address :[email protected]
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password :xxxxxxxxxxxxxx
An optional company name :Giant Geek Communications
You can now send this CSR to a valid Certifying Authority…
I currently use http://www.comodo.com/.
It’s very likely that the CA will need to verify your identity, typically this requires you to fax a copy of your id card/passport or business papers. A D-U-N-S Number (from Dun and Bradstreet) will make this easier for businesses.
If you don’t plan on having lots of users, you can create a Self-signed certificate…
openssl x509 —req —days 30 —in filename.csr —signkey filename.key —out filename.crt
You’ll need to install the files received from the CA, but it’s pretty trivial so I’ll leave it for later.