SlideShare a Scribd company logo
1 of 17
Download to read offline
Content Style
Text Style
Text style includes font-family, font-size, font-style, font-weight, font-variant.
Font Value
font-family Arial, Times New Roman, Courier New,
Georgia, Verdana
font-size 9px, 10px................Large
font-style Normal, italic, oblique
Font-weight Normal, bold, number
Font-variant Normal, small-caps
Example 1
<html>
<head>
<title>Content Style</title>
</head>
<body>
<style type="text/css">#f{font-family:Times New Roman;font-size:28px;font-
style:italic;font-weight:bold;font-variant:normal</style>
<div id ="f">Hello Friend's Welcome to PHPGurukul</div>
</body>
</html>
Output
Hello Friend's Welcome to PHPGurukul
Explanation
“font-family, font-size, font-style, font-weight, font-variant” specifies the text
style for the font.
Spacing
The line-weight can specify line spacing.
The word-spacing can specify word spacing.
The letter- spacing can specify letter spacing.
Example 2
<html>
<head>
<title>Content Style</title>
</head>
<body>
<style type="text/css">
#lineSpacing{line-height: 500%}
#wordSpacing{word-spacing: 10px}
#letterSpacing{letter-spacing: 5px}
</style>
<p id ="lineSpacing">Line Spacing Sample.</p>
<p id ="wordSpacing">Word Spacing Sample.</p>
<p id ="letterSpacing">Letter Spacing Sample.</p>
</body>
</html>
Output
Explanation
“line-height: 500%}” specifies the line height as 500%.
“word-spacing: 10px” specifies the word spacing as 10px.
“letter-spacing: 5px” specifies the letter spacing as 5px.
Divided Style
The dividing <div></div> tags are used to group their content elements as blocks.
<div> tags are useful for styling purposes.
<div class = “xxx”></div>
<div id = “xxx”></div>
The <div> tags can have id and class in css style.
Example 3
<!DOCTYPE html>
<html>
<head>
<title>Content Style</title>
</head>
<body>
<style type="text/css">
.d1{font-style: italic;color: red;}
#d2{font-family:arial black; color: blue;}
</style>
<div class="d1"><p>AAAAA</p>
<p>BBBBB</p>
<p>CCCCC</p></div>
<div id="d2">
<p>EEEEEE</p>
<p>FFFFFF</p>
<p>GGGGGG</p></div>
</body>
</html>
Output
AAAAA
BBBBB
CCCCC
EEEEEE
FFFFFF
GGGGGG
Explanation
<div class="d1"></div> is divided as first group which contains three pairs of <p>
tags they use “.d1” style.
<div class="d2"></div> is divided as second group which contains other three
pairs of <p> tags they use “#d2” style.
Span Style
<span></span> can be used to group elements for styling purposes(using the class
or id attribute).
<span class =”xxx ”></span>
<span id =”xxx ”></span>
The <span> tag can have id and class attribute in css style.
Example 4
<!DOCTYPE html>
<html>
<head>
<title>Content Style</title>
</head>
<style type="text/css">
div{background-color: yellow;}
.d1{font-style: italic;color: red;}
#d2{font-family:italic; color: blue;}
</style>
<body>
<div><p>This is AAAAA text,<span class="d1">This is BBBBB text,</span>This is
CCCCC text,<span id="d2"> This is DDDD text,</span>This is EEEEE text</p></div>
</body>
</html>
Output:
Explanation
The above uses <span></span> tags to set the css style of two pieces of text
within a paragraph which contained in a block.
<span> is very much like <div> element, but <div> is a block-level element
whereas a <span> is an inline element.
Border Style
border-style: value
“border-style: value” can set the border style by specifying different value. The
“value” may be “solid, double, dashed, dotes, groove, ridge, inset, outset”.
Example 5
<!DOCTYPE html>
<html>
<head>
<title>Content Style</title>
</head>
<style type="text/css">
#b1{border-style: solid;border-width: 10px;}
#b2{border-style: double;border-width: 10px;}
#b3{border-style: dashed;border-width: 10px;}
#b4{border-style: dotted;border-width: 10px;}
#b5{border-style: groove;border-width: 10px;}
#b6{border-style: ridge;border-width: 10px;}
#b7{border-style: inset;border-width: 10px;}
#b8{border-style: outset;border-width: 10px;}
</style>
<body>
<p id="b1">This is solid border</p><br>
<p id="b2">This is double border</p><br>
<p id="b3">This is dashed border</p><br>
<p id="b4">This is dotted border</p><br>
<p id="b5">This is groove border</p><br>
<p id="b6">This is ridge border</p><br>
<p id="b7">This is inset border</p><br>
<p id="b8">This is outset border</p><br>
</body>
</html>
Output
Explanation:
The “border-style: value” may be “solid, double, dashed, dotted, groove, ridge,
inset, outset”.
The “border-width: 10px” specifies the border width as 10 px.
Border Color
border-color: value
“border-color: value” can set the border properties for color
Example 6
<!DOCTYPE html>
<html>
<head>
<title>Content Style</title>
</head>
<style type="text/css">
#b5{border-style: groove;border-width: 20px;border-color: blue}
#b6{border-style: ridge;border-width: 20px;border-color: red}
</style>
<body>
<p id="b5">This is groove border</p><br>
<p id="b6">This is ridge border</p><br>
</body>
</html>
Output
Explanation:
“border-color: value” can set the border color.
Padding Style
The padding is the area around the text content in a content box. The padding
width can be specified with a padding attribute.
padding:value
Example 7
<!DOCTYPE html>
<html>
<head>
<title>Content Style</title>
</head>
<style type="text/css">
#b1{border-style: solid;border-width: 10px;padding: 10px}
#b2{border-style: dotted;border-width: 10px;padding: 20pxs}
</style>
<body>
<p id="b1">This is solid border</p><br>
<p id="b2">This is double border</p><br>
</body>
</html>
Output:
Explanation: “padding-value” can set the padding width.
Margin Style
The margin is the area around the border edges.
The margin width can be specified with a margin attribute.
margin:value
Example 8
<!DOCTYPE html>
<html>
<head>
<title>Content Style</title>
</head>
<style type="text/css">
#b1{border-style: solid;border-width: 10px;margin: 30px}
#b2{border-style: dotted;border-width: 10px;margin:0px}
</style>
<body>
<p id="b1">This is solid border</p><br>
<p id="b2">This is double border</p><br>
</body>
</html>
Output:
Explanation:
“margin: value” can set the margin width.
Absolute Positioning
The content position can be specified by position attribute.
position: absolute ; top: value; left: value;
“position: absolute” sets the precise location of the contents.
“top:value” set the distance from the top edge of the window.
“left:value” set the distance from the left edge of the window.
Example 9
<!DOCTYPE html>
<html>
<head>
<title>Content Style</title>
</head>
<style type="text/css">
#b1{position: absolute;top: 0px;left: 30px}
#b2{position: absolute;top: 30px;left: 60px}
</style>
<body>
<p id="b1">This is position 1</p><br>
<p id="b2">This is position 2</p><br>
</body>
</html>
Output:
Explanation:
“position: absolute ; top: value; left: value;” specifies the absolute distance from
the browser window edge.
Relative Positioning
position:relative;top:percentage;left:percentage
“position: relative” sets the relative location of the contents based on the browser
resolution or window size.
“top:percentage” sets the distance from the top edge of the window.
“left:percentage” sets the distance from the left edge of the window.
Example 10
<!DOCTYPE html>
<html>
<head>
<title>Content Style</title>
</head>
<style type="text/css">
#b1{position: relative;top:3%;left: 5%}
</style>
<body>
<p id="b1">This is relatived position</p><br>
</body>
</html>
Output
Explanation:
“position: relative;top:3%;left: 5%}” specifies the relative position based on the
resolution or size of the browser window.

More Related Content

What's hot (20)

Html
HtmlHtml
Html
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Css Founder.com | Cssfounder org
Css Founder.com | Cssfounder orgCss Founder.com | Cssfounder org
Css Founder.com | Cssfounder org
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
 
Web Design Assignment 1
Web Design Assignment 1 Web Design Assignment 1
Web Design Assignment 1
 
Css Complete Notes
Css Complete NotesCss Complete Notes
Css Complete Notes
 
Css
CssCss
Css
 
Cascstylesheets
CascstylesheetsCascstylesheets
Cascstylesheets
 
CSS - chained classes
CSS - chained classesCSS - chained classes
CSS - chained classes
 
CSS-3 Course Slide
CSS-3 Course SlideCSS-3 Course Slide
CSS-3 Course Slide
 
ID01 Week 3
ID01 Week 3ID01 Week 3
ID01 Week 3
 
Web Layout
Web LayoutWeb Layout
Web Layout
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
 
The Language of the Web - HTML and CSS
The Language of the Web - HTML and CSSThe Language of the Web - HTML and CSS
The Language of the Web - HTML and CSS
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
web development basics tables part2
web development basics tables part2web development basics tables part2
web development basics tables part2
 
Make Css easy : easy tips for css
Make Css easy : easy tips for cssMake Css easy : easy tips for css
Make Css easy : easy tips for css
 
Caracteristicas Basicas De Htlm
Caracteristicas Basicas De HtlmCaracteristicas Basicas De Htlm
Caracteristicas Basicas De Htlm
 
Html basic
Html basicHtml basic
Html basic
 
Html 2
Html   2Html   2
Html 2
 

Similar to Content style in html with example - PhpGurukul Tutorials

Similar to Content style in html with example - PhpGurukul Tutorials (20)

2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Css 1
Css 1Css 1
Css 1
 
Css1
Css1Css1
Css1
 
CSS
CSSCSS
CSS
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
Html Css
Html CssHtml Css
Html Css
 
HTML [Basic] --by Abdulla-al Baset
HTML [Basic] --by Abdulla-al BasetHTML [Basic] --by Abdulla-al Baset
HTML [Basic] --by Abdulla-al Baset
 
Cascade.ss
Cascade.ssCascade.ss
Cascade.ss
 
Html html html html html html html html html
Html html html html html html html html htmlHtml html html html html html html html html
Html html html html html html html html html
 
Xhtml tags reference
Xhtml tags referenceXhtml tags reference
Xhtml tags reference
 
CSS
CSSCSS
CSS
 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
 
CSS notes
CSS notesCSS notes
CSS notes
 
CSS Selectors: element, class, id
CSS  Selectors: element, class, idCSS  Selectors: element, class, id
CSS Selectors: element, class, id
 
TIBCO General Interface - CSS Guide
TIBCO General Interface - CSS GuideTIBCO General Interface - CSS Guide
TIBCO General Interface - CSS Guide
 
Html
HtmlHtml
Html
 
6_CasCadingStylesSheetsCSS.ppt
6_CasCadingStylesSheetsCSS.ppt6_CasCadingStylesSheetsCSS.ppt
6_CasCadingStylesSheetsCSS.ppt
 
cse labpractical.ppt
cse labpractical.pptcse labpractical.ppt
cse labpractical.ppt
 

Recently uploaded

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 

Recently uploaded (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 

Content style in html with example - PhpGurukul Tutorials

  • 1. Content Style Text Style Text style includes font-family, font-size, font-style, font-weight, font-variant. Font Value font-family Arial, Times New Roman, Courier New, Georgia, Verdana font-size 9px, 10px................Large font-style Normal, italic, oblique Font-weight Normal, bold, number Font-variant Normal, small-caps Example 1 <html> <head> <title>Content Style</title> </head> <body> <style type="text/css">#f{font-family:Times New Roman;font-size:28px;font- style:italic;font-weight:bold;font-variant:normal</style> <div id ="f">Hello Friend's Welcome to PHPGurukul</div> </body> </html>
  • 2. Output Hello Friend's Welcome to PHPGurukul Explanation “font-family, font-size, font-style, font-weight, font-variant” specifies the text style for the font. Spacing The line-weight can specify line spacing. The word-spacing can specify word spacing. The letter- spacing can specify letter spacing. Example 2 <html> <head> <title>Content Style</title> </head> <body> <style type="text/css"> #lineSpacing{line-height: 500%} #wordSpacing{word-spacing: 10px}
  • 3. #letterSpacing{letter-spacing: 5px} </style> <p id ="lineSpacing">Line Spacing Sample.</p> <p id ="wordSpacing">Word Spacing Sample.</p> <p id ="letterSpacing">Letter Spacing Sample.</p> </body> </html> Output Explanation “line-height: 500%}” specifies the line height as 500%. “word-spacing: 10px” specifies the word spacing as 10px. “letter-spacing: 5px” specifies the letter spacing as 5px.
  • 4. Divided Style The dividing <div></div> tags are used to group their content elements as blocks. <div> tags are useful for styling purposes. <div class = “xxx”></div> <div id = “xxx”></div> The <div> tags can have id and class in css style. Example 3 <!DOCTYPE html> <html> <head> <title>Content Style</title> </head> <body> <style type="text/css"> .d1{font-style: italic;color: red;} #d2{font-family:arial black; color: blue;} </style> <div class="d1"><p>AAAAA</p> <p>BBBBB</p>
  • 5. <p>CCCCC</p></div> <div id="d2"> <p>EEEEEE</p> <p>FFFFFF</p> <p>GGGGGG</p></div> </body> </html> Output AAAAA BBBBB CCCCC EEEEEE FFFFFF GGGGGG Explanation <div class="d1"></div> is divided as first group which contains three pairs of <p> tags they use “.d1” style. <div class="d2"></div> is divided as second group which contains other three pairs of <p> tags they use “#d2” style.
  • 6. Span Style <span></span> can be used to group elements for styling purposes(using the class or id attribute). <span class =”xxx ”></span> <span id =”xxx ”></span> The <span> tag can have id and class attribute in css style. Example 4 <!DOCTYPE html> <html> <head> <title>Content Style</title> </head> <style type="text/css"> div{background-color: yellow;} .d1{font-style: italic;color: red;} #d2{font-family:italic; color: blue;} </style> <body> <div><p>This is AAAAA text,<span class="d1">This is BBBBB text,</span>This is CCCCC text,<span id="d2"> This is DDDD text,</span>This is EEEEE text</p></div>
  • 7. </body> </html> Output: Explanation The above uses <span></span> tags to set the css style of two pieces of text within a paragraph which contained in a block. <span> is very much like <div> element, but <div> is a block-level element whereas a <span> is an inline element. Border Style border-style: value “border-style: value” can set the border style by specifying different value. The “value” may be “solid, double, dashed, dotes, groove, ridge, inset, outset”. Example 5 <!DOCTYPE html> <html>
  • 8. <head> <title>Content Style</title> </head> <style type="text/css"> #b1{border-style: solid;border-width: 10px;} #b2{border-style: double;border-width: 10px;} #b3{border-style: dashed;border-width: 10px;} #b4{border-style: dotted;border-width: 10px;} #b5{border-style: groove;border-width: 10px;} #b6{border-style: ridge;border-width: 10px;} #b7{border-style: inset;border-width: 10px;} #b8{border-style: outset;border-width: 10px;} </style> <body> <p id="b1">This is solid border</p><br> <p id="b2">This is double border</p><br> <p id="b3">This is dashed border</p><br> <p id="b4">This is dotted border</p><br> <p id="b5">This is groove border</p><br> <p id="b6">This is ridge border</p><br>
  • 9. <p id="b7">This is inset border</p><br> <p id="b8">This is outset border</p><br> </body> </html> Output
  • 10. Explanation: The “border-style: value” may be “solid, double, dashed, dotted, groove, ridge, inset, outset”. The “border-width: 10px” specifies the border width as 10 px. Border Color border-color: value “border-color: value” can set the border properties for color Example 6 <!DOCTYPE html> <html> <head> <title>Content Style</title> </head> <style type="text/css"> #b5{border-style: groove;border-width: 20px;border-color: blue} #b6{border-style: ridge;border-width: 20px;border-color: red} </style> <body> <p id="b5">This is groove border</p><br> <p id="b6">This is ridge border</p><br>
  • 11. </body> </html> Output Explanation: “border-color: value” can set the border color. Padding Style The padding is the area around the text content in a content box. The padding width can be specified with a padding attribute. padding:value Example 7 <!DOCTYPE html> <html> <head>
  • 12. <title>Content Style</title> </head> <style type="text/css"> #b1{border-style: solid;border-width: 10px;padding: 10px} #b2{border-style: dotted;border-width: 10px;padding: 20pxs} </style> <body> <p id="b1">This is solid border</p><br> <p id="b2">This is double border</p><br> </body> </html>
  • 13. Output: Explanation: “padding-value” can set the padding width. Margin Style The margin is the area around the border edges. The margin width can be specified with a margin attribute. margin:value Example 8 <!DOCTYPE html> <html> <head> <title>Content Style</title> </head> <style type="text/css"> #b1{border-style: solid;border-width: 10px;margin: 30px}
  • 14. #b2{border-style: dotted;border-width: 10px;margin:0px} </style> <body> <p id="b1">This is solid border</p><br> <p id="b2">This is double border</p><br> </body> </html> Output: Explanation: “margin: value” can set the margin width. Absolute Positioning
  • 15. The content position can be specified by position attribute. position: absolute ; top: value; left: value; “position: absolute” sets the precise location of the contents. “top:value” set the distance from the top edge of the window. “left:value” set the distance from the left edge of the window. Example 9 <!DOCTYPE html> <html> <head> <title>Content Style</title> </head> <style type="text/css"> #b1{position: absolute;top: 0px;left: 30px} #b2{position: absolute;top: 30px;left: 60px} </style> <body> <p id="b1">This is position 1</p><br>
  • 16. <p id="b2">This is position 2</p><br> </body> </html> Output: Explanation: “position: absolute ; top: value; left: value;” specifies the absolute distance from the browser window edge. Relative Positioning position:relative;top:percentage;left:percentage “position: relative” sets the relative location of the contents based on the browser resolution or window size. “top:percentage” sets the distance from the top edge of the window. “left:percentage” sets the distance from the left edge of the window.
  • 17. Example 10 <!DOCTYPE html> <html> <head> <title>Content Style</title> </head> <style type="text/css"> #b1{position: relative;top:3%;left: 5%} </style> <body> <p id="b1">This is relatived position</p><br> </body> </html> Output Explanation: “position: relative;top:3%;left: 5%}” specifies the relative position based on the resolution or size of the browser window.