Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

What is External Stylesheet?

What is External Stylesheet?

    • By Using External Style Sheet , you can change the look or design of an website by changing only one file.
    • External means to create a CSS outside the Html file .
    • <link > tag is used .
    • The Link Tag write in the Head section ie  
    • <head>  external stylesheet    </head>
Example
    • <head>
      <link rel="stylesheet" type="text/css" href="externalstylesheet.css">
      </head>
    • In external Stylesheet not contain any HTML Tag.
  •  Attribute rel will contain the value stylesheet .
  •  href will contain the location of the css file.
  • we create a CSS File and Save   (dot) .CSS extension 
Example:

1 Open a Notepad and Create a CSS Page , save by style.css 

   
body {

    background-color:blue;
}


h1 {
    color: red;
    margin-left: 20px;
}


h2 {
Color:pink;
}


save-as style.css.


2 Open another Notepad , write this below Code

<!DOCTYPE html>
<html>
 <head>

<link rel="stylesheet" type="text/css" href="style.css">

</head>
<body>

<h1> HELLO  H1 is red </h1>  <br>
<h2>  HEllo H2 is pink color </h2>


</body>
</html>  


save the externalstyle.html


Output:



NOTE

IF we change in style.css file  then automatically change the output See Below


body {

    background-color:skyblue;
}


h1 {
    color: black;
   
}


h2 {
Color:red;
}


Output:







What is CSS?


CSS 


  • It is Called Cascading Style Sheet.
  • It is used to format the layout of webpage.
  • There are three type of CSS 
  1. Internal
  2. External
  3. In line 

  1. In line 

  • An inline style may be used to apply a unique style for a single element.
  • To use inline styles, add the style attribute to the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a <h1> element:
example:


<!DOCTYPE html>

<html>
<body>

<p style="font-family:verdana; color:black; background-color:red;">Hello Everone .</p>


</body>
</html> 

Output: 

Hello Everone .

Internal Style sheet

 all elements are defined in style element normally in head part.

■ This method has the second highest priority among three methods.

■ id attribute of the element to be styled is used to mention it in style element.

Syntax

<style type= "text/css">
#id{css code;}

</style>

Example:


<html>
<head>

<style>
p{background-color:pink;}
</style>
</head>

<body>
<p>Notepad is a basic text-editing program and it's most commonly used to view or edit text files. A text file is a file type typically identified by the .txt file name extension.
</p>

</body>
</html>


Output: 







TAG:  













How to Use a class in CSS

Class in CSS  

 Class is denoted by . (dot)


1 Open Notepad and write this code

<HTML>
<HEAD>

<STYLE>

IMG.a{BORDER-STYLE:INSET;BORDER-COLOR:BLUE;BORDER-RADIUS:1PX;OUTLINE-COLOR:BLUE;BORDER-WIDTH:20PX;}

IMG.b{BORDER-STYLE:INSET;BORDER-COLOR:BLUE;BORDER-RADIUS:5PX ;OUTLINE-COLOR:BLUE;BORDER-WIDTH:20PX;HEIGHT:200PX;WIDTH:200PX;}
IMG.c{BORDER-STYLE:INSET;BORDER-COLOR:BLUE;BORDER-RADIUS:50PX ;OUTLINE-COLOR:BLUE;BORDER-WIDTH:20PX;HEIGHT:250PX;WIDTH:200PX;}

</STYLE>


</HEAD>
<BODY>
<IMG CLASS=a SRC="SUN.PNG">
<IMG CLASS=b SRC="TULIPS.JPG">
<IMG CLASS=c SRC="nn.JPG">
</BODY>
</HTML>


2 Output:



How to Create HTML Table

How to Create HTML Table

Introduction to table 
  • Table  tag is used to create a table in html.ie  <table>
  • Tables are divided into table rows with the <tr> tag.
  • Table rows are divided into table data with the <td> tag.
  • A table row can also be divided into table headings with the <th> tag.
  • All these tags are in pair.
example:  In below i create a table in which have three row and three column .


  ROWS  (<tr> tag )

   Table Division (<td>)








STEPS 
1  Open Notepad 

2 Write Code 





<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th>Student Name</th>
<th>Roll Number</th>
</tr>
<tr>
<td>Vinod</td>
<td>01</td>
</tr>
<tr>
<td>Bhim</td>
<td>10</td>
</tr>
<tr>
<td>Vikash</td>
<td>21</td>
</table>
</body>

</html>



Output:


Student Name Roll Number
Vinod 01
Bhim 10
Vikash 21




How to Create HTML Table

How to Create HTML Table

Introduction to table 
  • Table  tag is used to create a table in html.ie  <table>
  • Tables are divided into table rows with the <tr> tag.
  • Table rows are divided into table data with the <td> tag.
  • A table row can also be divided into table headings with the <th> tag.
  • All these tags are in pair.
example:  In below i create a table in which have three row and three column .


  ROWS  (<tr> tag )

   Table Division (<td>)








STEPS 
1  Open Notepad 

2 Write Code 





<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th>Student Name</th>
<th>Roll Number</th>
</tr>
<tr>
<td>Vinod</td>
<td>01</td>
</tr>
<tr>
<td>Bhim</td>
<td>10</td>
</tr>
<tr>
<td>Vikash</td>
<td>21</td>
</table>
</body>

</html>



Output:


Student Name Roll Number
Vinod 01
Bhim 10
Vikash 21