Sunday, November 30, 2008

Javascript Events

Friday, November 21, 2008

How to set the signin page to use framed cobranding?

To implement framed cobranding for Windows Live ID sign-in pages, put a Cobranding_Flexible and a Cobranding_CSS element after the general cobranding properties within the Cobranding element.

Saturday, November 15, 2008

What is the difference between p tag, div tag, span tag?

A span element is in-line and usually used for a small chunk of in-line HTML.

A div or a P element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.

CSS tips

1. Once I wanted to make my side bar on z-index:1 and make it float to the right. Then I found it is impossible for the following reason. To make z-index work, I need position:absolute. Having position:absolute will disable floating. Eventually, I used z-index+position:absolute and some manually alignment to make this work.

Relationships between display, position, and float

Rule 1:
If 'display' has the value 'none', user agents must ignore 'position' and 'float'. In this case, the element generates no box.

Rule 2:
Otherwise, 'position' has the value 'absolute' or 'fixed', 'display' is set to 'block' and 'float' is set to 'none'. The position of the box will be determined by the 'top', 'right', 'bottom' and 'left' properties and the box's containing block.

Rule 3:
Otherwise, if 'float' has a value other than 'none', 'display' is set to 'block' and the box is floated.

Rule 4:
Otherwise, the remaining 'display' properties apply as specified.

Thursday, November 13, 2008

Why height=100% does not work?


#main /* the direct child div under body */
height:100%; /* this does not stretch the div to 100% */

The reason is that without a parent defined height, the div{height:100%;} has nothing to factor 100% percent of, and will default to a value of div{height:auto;} - auto is an "as needed value" which is governed by the actual content, so that the div{height:100%} will a=only extend as far as the content demands.

So these change will make the height:100% work:

#main /* the direct child div under body */
height:100%; /* this does stretch the div to 100% (of body) */

Wednesday, November 12, 2008

How to make the content in a DIV center aligned?

Use "margin-left:auto" and "margin-right:auto" for horizontal centering.

It is said online (in one of Jennifer Sullivan Cassidy's articles) that it is not recommended to use "text-align: center;" for horizontal centering for some reason.

vertical-align is for table only and vertical aligning a div is not a trivial thing.

Here is a good way to vertically align a div:

What do the CSS position values mean?

static Default. An element with position: static always has the position the normal flow of the page gives it (a static element ignores any top, bottom, left, or right declarations)

relative An element with position: relative moves an element relative to its normal position, so "left:20" adds 20 pixels to the element's LEFT position

absolute An element with position: absolute is positioned at the specified coordinates relative to its containing block. The element's position is specified with the "left", "top", "right", and "bottom" properties

fixed An element with position: fixed is positioned at the specified coordinates relative to the browser window. The element's position is specified with the "left", "top", "right", and "bottom" properties. The element remains at that position regardless of scrolling. Works in IE7 (strict mode)

What is the default height of a div if I do not specify?

The default is auto. The browser calculates the actual height.

If there is control in this div, then the height will be adjusted to fit this control in.

If there is no control in this div, then the height is a standard height which can fit a label in.

Monday, November 10, 2008

ASP.NET page life cycle diagram 2


ASP.NET page life cycle diagram

How to find out whether a NET dll is arch (32-bit or 64-bit) independent or not?

C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\CorFlags.exe

For example, AntiXssLibrary.dll does not have the “32-bit only” bit set. It should work fine in 64-bit.

[1] » corflags AntiXssLibrary.dll
CorFlags : 9
32BIT : 0
Signed : 1

Saturday, November 8, 2008