Uploaded by Suraj Madushanka

CSS -HTML doc

advertisement
CSS stands for cascading style sheet it is use to style the web pages that is stretched by HTML
CSS is applied in three different face
01. Inline CSS
02. Internal CSS
03. Extranal CSS
01.Inline CSS
CSS is defined with the style attribute.
<h1 style="color:red; backgroun-color:yello;"></h>
<p style= "___">
*Internal CSS
CSS is defined within he<style> tag in the <head>. CSS show be defined per page. Every web page will
have separate CSS definitions.
*selectors
Selectors are used to select elements for styling; there are three type of selectors
01. Element selectors – element names are used all the element of the selected type within the web
page will be applied.
Ex: h1
p h1,h2,h3
02. Class selector – the target elements are assign with a class name to assign a class use the class
attribute
<p class=’’cls1”></p>
<p class=’’cls3”></p>
<p class=’’cls1 cls2”></p>
To select classes for style used a period with the class name
.cls1
.cls3
.cls1, .cls3
*Multiple element can below to the same class styles applied for a class will affect all the element with
that particular class.
03. ID selector – The target element is assign with unique ID and element can have only one ID
EX:
p id-“p1”></p>
p id-“p2”></p>
To select element with particular ID use the pound symbol (#)
EX:
#p1
#p2
#p1,#p2
External CSS
The CSS declaration are saved in a separate .css file. That file can be linked to any web page using he
<link> tag.
If the css file is stored in the style.css file which is in the same directory as the HTML file

Same selectors used for internal CSS can be used for external CSS
CSS Syntax used for external and internal CSS.
Download