PYTHON  
 
  Oracle Forms & PL/SQ  
 
  ROR  
 
  Java  
 
  php  
 
  ask us  
 
  home  
 

 

Web Technologies






XML
CSS stands for Cascading Style Sheets .
It controls the style of HTML elements
and the layout of HTML documents.

I. Internal CSS style:

Internal CSS is useful for a single document that will have a unique style.
This style is written inside the head element of the document as the following example:
<head>
<style type="text/css">
<!--
body {font-size:12pt; margin:0.5em;color:white;background-image: url("Images/CAT.png");
background-repeat: repeat}
h1,h2,h3 {color:red;font-family:"bookman old style"}
b {color:green}
tr {margin-left: 15px}
. name {text-decoration:underline;bgcolor:#ffccff}
p.name1 {text-align:left; margin-right:2.5em; font-weight: 900}
p.name2 {font-weight:bold}
#name3 {font-family:arial; color:purple}
td#name4 {font-size: 12pt; font-weight: bold; backgroud: #fcf4f4}
input[type="button"] {background-color: green; background-color: rgb(100,20,200 }
table {background-color: transparent}
/* Comment: tr {backgroud: #fcf4f4; margin-left: 50px . px stands for pixels*/

a:link {color:black}
a:visited {color:red}
a:hover {color:green}
a:active {color:white}

-->
</style>
</head>


External CSS are stored in style sheets file.css. CSS definitions will cascade into one for a style of a document. Multiple files.css can be used for one document or more documents; and one CSS file can be used for multiple documents.

In the case of styles overlaps, the priority is:
1. Style inside HTML elements (inline Style),
2. Style inside <head> elements (internal Style),
3. Style from css external files (External Style),
4. Default style comming with browswers.
But:
The requested properties that are not in a style will be taken from its following.


(Example:
All the properties in the above internal style will be taken into account, plus the property for <hr /> wchich is present in file.css when the document links to it.)


The CSS general syntax contains: a selector, a property and its value like this:
selector {property:value}

The value is quotted when it contains plus one word. The properties inside the selector are separated by semicolons.
We can group multiple selectors to have specific properties with their values.

A class selector contains any name after a dot (like .name) defined as a style. It can be used by any element as class property, like this: <div class = "name">
The division tag groups HTML elements inside a document;
<span class = "name"> whereas span tag group a part of a content inside an HTML element.
</span>
</div>


Different class selector attributes give different styles for the same type of HTML element. like this:
<p class = "name1">This paragraph or </p>
<p class = "name1 name2">This one</p>
(We have then two paragraphs with different styles).

We can also use the style in this manner:
selector [attribute1 = "value1"] {attribute2:value2}
or:
An id selector like this:
<p id = "name3"> or
<td id = "name4">


The HTML comment element <!-- and --> wrapp the definitions of an internal SCC style to prevent old browsers that not understand style tags to display their content.

II. External CSS style:

The HTML document will insert the style sheet file file.css as follows:
<head>
<link rel="stylesheet" type="text/css" href="file.css" />
</head>
An external style sheet is useful when many pages will use the same style to be formatted.
Example of file.css: Css.css


III. Inline style:

It is used in special cases, like this:
<p style="margin-left: 30px; color: blue">
here a special point whom the style is different from the other that inherite from internal or external SCC style sheet.
</p>


IV. Background:

We can set backgrounds for the elements body, h, p, etc... as follows:
background-color: silver
background-color: transparent
background-color: rgb(150,10,200)
background-color: #ffccff
background-image: url('CAT.png')
background-repeat: repeat
Horizonally:
background-repeat: repeat-x
Vertically:
background-repeat: repeat-y
background-repeat: no-repeat
background-attachment:fixed;
background-position:center;
background-position: 30% 20%;
background-position: 50px 100px;
background: #CFCFCF url('CAT.png') no-repeat fixed center;

V. Text:

text-align: center
text-align: left
text-align: right
text-transform: uppercase
text-transform: lowercase
text-transform: capitalize (transform to capital letters)
text-decoration: overline
text-decoration: line-through
text-decoration: underline
text-decoration: none
text-indent: 1cm
direction: rtl (text: aligned from left)
direction: ltr (text: aligned from right)
word-spacing: 30px
white-space: nowrap


VI. Fonts:

font-family: times
font-family: courier
font-family: sans-serif
font: caption
font-size: 100%
font-style: italic
font-style: normal
font-style: oblique
font-variant: normal
font-variant: small-caps
font-weight: normal
font-weight: bold
font-weight: 900


VII. Margin:

margin-top: 5cm
margin-top: 10%
margin-bottom: 2cm
margin-bottom: 25%
margin-left:3cm
margin-left: 33%
margin-right: 5cm
margin-right:45%
margin: 3cm 5cm 4cm 2cm

VIII. Padding text inside tables:

padding: 1.5cm
padding: 0.5cm 2.5cm
padding-top: 2cm
padding-top: 10%
padding-bottom: 2cm
padding-bottom: 10%
padding-left: 2cm
padding-left: 10%
padding-right: 5cm
padding-right: 10%


IX. Lists:

list-style-type: disc
list-style-type: circle
list-style-type: square
list-style-type: decimal
list-style-type: lower-roman
list-style-type: upper-roman
list-style-type: lower-alpha
list-style-type: upper-alpha
list-style-image: url('arrow.jpg')
list-style-position: inside
list-style-position: outside


X. Image opacity:

<img src="CAT.png" style="opacity:0.5;filter:alpha(opacity=50) />

<img src="CAT.png" style="opacity:0.6;filter:alpha(opacity=50)" onmouseover="this.style.opacity=2;this.filters.alpha.opacity=100" onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />

That gives:

Mercedes 250, 1978's year

XI. Table:

table-layout: automatic
table-layout: fixed
caption-side:top
border-collapse: separate;empty-cells: show
border-collapse: collapse
border-collapse: separate
border-collapse: separate;border-spacing: 10px



Valid XHTML 1.0 Transitional



Valid CSS! : To validate the css file:
http://www.scientificsentence.net/webTechnologies/CSS/CSS.css



  
Google
Web
ScientificSentence
 



chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2011. All rights reserved.