How to use CSS in HTML 3rd tutorial
3 ways to link CSS -Inline styling -Internal Stylesheet -External Stylesheet
-applied to particular elements Inline Styling -inside the html tags only
<! DOCTYPE html> html> <body> This is a paragraph. <p style="color: red ; text-align: center; "This is a paragraph.</p> </body> </html>
-styling done inside the html page only Internal StyleSheet -inside style tag which is included in head tag of the html page
<I DOCTYPE html> <html> head> This is a paragraph. type="text/css"> <style pf color: blue; text-align: center; </style> /head> <body> <p >This is a paragraph.</p </body> /html>
-a separate.css file is generated External StyleSheet -it includes on the css code -then this file has to be included in our html page -<link> is used to include stylesheet in html file -another way is to import the stylesheet
1 2 3 4 color: red; text-align: center; abc.css DOCTYPE htm <html> <head> <link rel-"stylesheet" type="text/css" href="abc.css"> </head> Kbody> Kp >This is a paragraph.</p> <p This is a paragraph.</p> </body> </htmi>
When to use what?
external sheets (proper way) Can be used in any number of html files -internal stylesheet If we are creating website of one page only( then recommended) -inline styling If we want to style some particular element uniquely i.e that style is applied to only that element on a single web page
Hi, I'm Jigyasa Agrawal, Currently pursuing B.Tech in computer engineering at GBPUAT pantnagar.