![]() |
Updated 07/18/14 |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Using Cascading Style Sheets in your JavaScripts This section will demonstrate a few simple JavaScripts using CSS You can create style sheets in an externally or internally. Using an external style sheet you can use one page to modify styles used on several pages on a website. Internal styles are either used in the head tag or what we call inline style which is used inside an HTML element. Here is an example of an internal style sheet being used for the <h1> tags in the following example: All text in the h3 tags are centered and the background is changed. The code for this script is below the actual script.
Using CSSNo CSSMore CSS<html> <body> You can modify just about any html element in a web
page I'll give you one more example. This time I'm going to modify the p
tag using class selectors. First I'll show you the script and the
code will follow. See the text is red and aligned to the center Second paragraph has the right align Now the 3rd paragraph is aligned to the left
Now here is the code for the above script: <head> <!-- Now I'll use them in the body referencing the
correct class selector --> See using CSS is pretty easy you can change any HTML element in a web page and you can either change every element on a page, every element on a website or just one element. Now try using CSS in one of your JavaScript pages. If you need some properties to get started try looking them up at http://www.devguru.com/
|
This site was last updated 07/16/14