Skip to main content

Posts

Showing posts from November, 2014

CSS Background

CSS background properties are used to define the background effects of an element. CSS properties used for background effects: background-color background-image background-repeat  ( no-repeat,repeat-x & repeat-y) background-attachment background-position With CSS, a color is most often specified by: a HEX value - like "#ff0000" an RGB value - like "rgb(255,0,0)" a color name - like "red"

CSS - How to insert.

There are three ways of inserting a style sheet: External style sheet < head > < link   rel= "stylesheet"   type= "text/css"   href= "mystyle.css" > < /head > Internal style sheet <head> <style> body  {      background-color:  linen; } h1  {      color:  maroon;      margin-left:  40px; }  </style> </head> Inline style < h1   style= "color:blue;margin-left:30px;" > This is a heading. < /h1 > If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet.  What style will be used when there is more than one style specified for an HTML element? Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest prio...

CSS Syntax

Comments /* This is a multi-line comment */ CSS selectors A CSS rule set consists of a selector and a declaration block. Sample p {     color: red;     text-align: center; }  p -> selector  The element selector selects elements based on the element name. You can select all <p> elements on a page like this: (all <p> elements will be center-aligned, with a red text color) The id selector uses the id attribute of an HTML tag to find the specific element.  Use #for ID. The style rule below will be applied to the HTML element with id="para1": #para1  {      text-align:  center;      color:  red; } ! ---  Do  NOT  start an ID name with a number! n the example below, all HTML elements with class="center" will be center-aligned: The class selector finds elements with the specific class. Use . for Class .center  {   ...