Labels

Showing posts with label CSS-HTML. Show all posts
Showing posts with label CSS-HTML. Show all posts

Thursday, July 5, 2007

Priniting using CSS

<head runat="server">

            <link rel="stylesheet" href="css/screen.css" type="text/css" media="screen"/>

            <link rel="stylesheet" href="css/print.css" type="text/css" media="print"/>

            <link href="css/ButtonRollover.css" rel="stylesheet" type="text/css" />

            <link href="css/Miscellaneous.css" rel="stylesheet" type="text/css" />

</head>

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Vraious Modes in HTML

-----------------------------

 

"Legacy" mode (non-XHTML markup )

Transitional mode (XHTML Transitional)

 Strict mode (XHTML Strict). 

 

Note:

ASP.NET 1.0 and 1.1 didn't emit XHTML compliant markup from many of its server controls.  ASP.NET 2.0 changed this and by default emits XHTML compliant markup from all controls.

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Tuesday, June 26, 2007

Catch the Error and remember the tip!!

Problem: I am trying to write a small test program but it doesn't seem to run in IE though it runs absolutely fine in FF!!

 

Here is my HTML

<html>
 <head>
  <title>Greedy!</title>
 </head>
 <body>
 <script type="text/javascript" src="somescript.js" />

     Hi!!!!!!!!!!
 <div style="border:1px solid black;height:10px;width:100px;" onclick="test();"></div>
 </body>
</html>

 

Here is the somescript.js

function test(){

        alert("Hi");

}

 

Try finding the catch here before reading for answer.

 

 

Solution: If this were a real page, the results would have been pretty much the same, no matter what or how much content was on it. A blank page! You might even get some JavaScript errors thrown in too. Errors like "object expected", for an object you know for sure exists.

The problem is that the <Script> element cannot be self closing. It's interpreted as having no closing tag, and so all of the content after the script element is inside the script element -- and therefore does not appear in the visible output. It also makes dom elements that you'd normally expect to be around non-existent, which can cause errors in any script that does happen to load. So you might get a JavaScript error, followed by the blank page.

Change your script tag like so, and problem solved:

<script type="text/javascript" src="somescript.js" ></script>

This appears to be an IE issue -- works fine in FF and may other browsers too!

 

Tip: Do not try to self-close all the tags. Some of them are supported while others are not. It’s always a good idea to have full closing tag wherever possible.

 

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

Wednesday, June 6, 2007

CSS: Changing the precedence of styling

Background: All of us must be aware that CSS styling are applied by the browser as and when they are read by the browser, hence the ‘C’ for Cascading in CSS. Now when we define a style for an element in say head tag of your page, and then provide the same style as inline while defining the element, we know that the styling done as inline would override the styling done in head tag. See the snippet below:

<head runat="server">

    <title>Precedence Test</title>

    <style type="text/css">

        p{ color:green;}

    </style>

</head>

<body>

    <p style="color:Red;">Which color do I render in?</p>

</body>

Yes, you know the answer, its Red color.

Problem: Now here is a situation, I always want to ensure that the content inside p tag is rendered in green color and must not consider any other styling related to color. Can this be done? Why / How?

Solution: Yes, there is a way to override the default precedence. See the below code snippet

<head runat="server">

    <title>Precedence Test</title>

    <style type="text/css">

        p{ color:green !Important;}

    </style>

</head>

<body>

    <p style="color:Red;">Which color do I render in?</p>

</body>

This time the text renders in Green color. The “!Important” attribute makes sure that this style always has precedence against its counterparts.

Test your understanding: Guess the Color of the rendered text?

<head runat="server">

    <title>Precedence Test</title>

    <style type="text/css">

        p{ color:green !Important;}

    </style>

</head>

<body>

    <p style="color:Red !Important;">Which color do I render in?</p>

</body>

 

 

Thanks & Regards,

Arun Manglick

SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.