If you declare a variable in a function, it overrides a variable that is global.
That is, if you have
var mynum=1234;
function xyz()
{
var mynum=34;
}
you have created a local variable.
Tuesday, August 31, 2010
Wednesday, August 25, 2010
CSS Classes and ID's
use the period in the CSS for class designation.
Use the # for ID designation.
< p class=”BackgroundNote” > This paragraph contains an aside. < /p >
.BackgroundNote {}
Or you can create a selector that selects only the < p > elements that carry a class attribute with a value
of BackgroundNote (not other elements) like so:
p.BackgroundNote {}
If you have several elements that can all carry a class attribute with the same value (for example a < p >
element and a < div > element could both use the class attribute with the same value) and you want the
content of these elements to be displayed in the same manner, you will want to use the former notation.
If the styles you are defining are specific to just the < p > element whose class attribute has a value of
BackgroundNote , then you should use the latter notation.
A class attribute can also contain several values separated by a space — for example:
< p class=”important code” >
You can use the following syntax to indicate an element that has a class attribute whose value contains
both important and code (although IE7 was the first version of Internet Explorer to support this
syntax).
p.important.code {}
The ID Selector
The id selector works just like a class selector, but works on the value of id attributes. Rather than using a
period or full stop before the value of the id attribute, you use a hash or pound sign ( # ). So an element
with an id attribute whose value is abstract can be identified with this selector.
#abstract
Because the value of an id attribute should be unique within a document, this selector should apply
only to the content of one element (and you should not have to specify the element name).
The Child Selector
The child selector matches an element that is a direct child of another. In this case it matches any
< b > elements that are direct children of < td > elements. The names of the two elements are separated by a
greater - than symbol to indicate that b is a child of td ( > ) which is referred to as a combinator :
td > b {}
This would enable you to specify a different style for < b > elements that are direct children of the < td >
element compared with < b > elements that appear elsewhere in the document.
As a direct child of the < td > element, no other tags would sit between the opening < td > tag and the
< b > element. For example, the following selector does not make sense because the < b > element should
not be a direct child of a < table > element (instead, a < tr > element is more likely to be the direct child of
a < table > element):
table > b {}
IE7 was the first version of Internet Explorer to support the child selector.
The Descendant Selector
The descendant selector matches an element type that is a descendant of another specified element (or
nested inside another specified element), not just a direct child. While the greater - than symbol is the
combinator for the child selector, for the descendent selector the combinator is the space. Take a look at
this example:
table b {}
In this case, the selector matches any < b > element that is a child of the < table > element, which means it
would apply to < b > elements both in < td > and < th > elements.
Use the # for ID designation.
< p class=”BackgroundNote” > This paragraph contains an aside. < /p >
.BackgroundNote {}
Or you can create a selector that selects only the < p > elements that carry a class attribute with a value
of BackgroundNote (not other elements) like so:
p.BackgroundNote {}
If you have several elements that can all carry a class attribute with the same value (for example a < p >
element and a < div > element could both use the class attribute with the same value) and you want the
content of these elements to be displayed in the same manner, you will want to use the former notation.
If the styles you are defining are specific to just the < p > element whose class attribute has a value of
BackgroundNote , then you should use the latter notation.
A class attribute can also contain several values separated by a space — for example:
< p class=”important code” >
You can use the following syntax to indicate an element that has a class attribute whose value contains
both important and code (although IE7 was the first version of Internet Explorer to support this
syntax).
p.important.code {}
The ID Selector
The id selector works just like a class selector, but works on the value of id attributes. Rather than using a
period or full stop before the value of the id attribute, you use a hash or pound sign ( # ). So an element
with an id attribute whose value is abstract can be identified with this selector.
#abstract
Because the value of an id attribute should be unique within a document, this selector should apply
only to the content of one element (and you should not have to specify the element name).
The Child Selector
The child selector matches an element that is a direct child of another. In this case it matches any
< b > elements that are direct children of < td > elements. The names of the two elements are separated by a
greater - than symbol to indicate that b is a child of td ( > ) which is referred to as a combinator :
td > b {}
This would enable you to specify a different style for < b > elements that are direct children of the < td >
element compared with < b > elements that appear elsewhere in the document.
As a direct child of the < td > element, no other tags would sit between the opening < td > tag and the
< b > element. For example, the following selector does not make sense because the < b > element should
not be a direct child of a < table > element (instead, a < tr > element is more likely to be the direct child of
a < table > element):
table > b {}
IE7 was the first version of Internet Explorer to support the child selector.
The Descendant Selector
The descendant selector matches an element type that is a descendant of another specified element (or
nested inside another specified element), not just a direct child. While the greater - than symbol is the
combinator for the child selector, for the descendent selector the combinator is the space. Take a look at
this example:
table b {}
In this case, the selector matches any < b > element that is a child of the < table > element, which means it
would apply to < b > elements both in < td > and < th > elements.
Providers Web Blog
This blog is used to document pertinent information used when creating web sites. Stuff such as javascript, html, css, etc.
Subscribe to:
Posts (Atom)