[thelist] (OT) Stylesheet based on URL

Diane Soini dianesoini at earthlink.net
Fri Nov 7 20:21:44 CST 2003


But this would put white space at the top before the doctype. It was 
brought to my attention on this list that this causes browsers to go 
into quirks mode.

Maybe your server will remove the white space?

On Thursday, November 6, 2003, at 10:47 PM, 
thelist-request at lists.evolt.org wrote:

> A simple example would be below. Notice how the bit between 
> <html></html>
> contains no ASP.Net code? That makes it easier to sort out presentation
> issues in the HTML editor of your choice (you can just cut-n-paste it 
> for a
> real quick-n-nasty approach to generating the HTML)
>
> <script runat="server">
>     Sub Page_Load(sender as object, e as eventargs)
>
>         SetStyles()
>
>     End Sub
>
>     Sub SetStyles()
>
>         Dim strServerName as String
>         Dim strStyleSheetName as String
>         strServerName =
> Request.ServerVariables("Server_Name").toString.ToLower()
>
>         Select Case strServerName
>             Case "company1.mydomain.co.uk"
>                 strStyleSheetName = "company1"
>             Case "company2.mydomain.co.uk"
>                 strStyleSheetName = "company2"
>             Case Else
>                 strStyleSheetName = "default"
>         End Select
>
>         theHead.Controls.Add(New LiteralControl("<link 
> rel=""stylesheet""
> type=""text/css"" href="/inc/CSS/" & strStyleSheetName & ">")
>
>     End Sub
> </script>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
>
>     <head runat="server" id="theHead">
>         <title>Some Sample Page</title>
>     </head>
>
>     <body>
>     </body>
> </html>



More information about the thelist mailing list