SlideShare a Scribd company logo
HTML Styles- CSS
What is CSS?
• CSS stands for Cascading Style Sheets.
• CSS saves a lot of work. It can control the layout of multiple web
pages all at once.
• Cascading Style Sheets (CSS) is used to format the layout of a
webpage.
• With CSS, you can control the color, font, the size of text, the spacing
between elements, how elements are positioned and laid out, what
background images or background colors are to be used, different
displays for different devices and screen sizes,
Using CSS
• CSS can be added to HTML documents in 3 ways:
• Inline - by using the style attribute inside HTML elements
• Internal - by using a <style> element in the <head> section
• External - by using a <link> element to link to an external CSS file
Inline CSS
• An inline CSS is used to apply a unique style to a single HTML
element.
• An inline CSS uses the style attribute of an HTML element.
• Example
• <h1 style="color:blue;">A Blue Heading</h1>
• <p style="color:red;">A red paragraph.</p>
Internal CSS
• An internal CSS is used to define a style for a single HTML page.
• An internal CSS is defined in the <head> section of an HTML page, within a <style> element.
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
External CSS
• An external style sheet is used to define the style for many HTML pages
• . Example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
• The external style sheet can be written in any text editor. The file must
not contain any HTML code, and must be saved with a .css extension.
body {
background-color: powderblue;
}
h1 {
color: blue;
}
p {
color: red;
}
CSS Colors, Fonts and Sizes
• The CSS color property defines the text color to be used.
• The CSS font-family property defines the font to be used.
• The CSS font-size property defines the text size to be used.
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: blue;
font-family: verdana;
font-size: 300%;
}
p {
color: red;
font-family: courier;
font-size: 160%;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
CSS Border
• The CSS border property defines a border around an HTML element.
• Example
• Use of CSS border property:
• p {
• border: 2px solid powderblue;
• }
CSS Padding
• The CSS padding property defines a padding (space) between the text and the
border.
• Example
• Use of CSS border and padding properties:
• p {
• border: 2px solid powderblue;
• padding: 30px;
• }
CSS Margin
• The CSS margin property defines a margin (space) outside the border.
• Example
• Use of CSS border and margin properties:
• p {
• border: 2px solid powderblue;
• margin: 50px;
• }
Link to External CSS
• External style sheets can be referenced with a full URL or with a path
relative to the current web page.
• Example
• This example uses a full URL to link to a style sheet:
• <link rel="stylesheet" href=“css/styles.css">
• Use the HTML style attribute for inline styling
• Use the HTML <style> element to define internal CSS
• Use the HTML <link> element to refer to an external CSS file
• Use the HTML <head> element to store <style> and <link> elements
• Use the CSS color property for text colors
• Use the CSS font-family property for text fonts
• Use the CSS font-size property for text sizes
• Use the CSS border property for borders
• Use the CSS padding property for space inside the border
• Use the CSS margin property for space outside the border
HTML Tables
• HTML tables allow web developers to arrange data into rows and
columns.
• Company Contact Country
• Alfreds Futterkiste Maria Anders Germany
• Centro comercial Moctezuma Francisco Chang Mexico
• Ernst Handel Roland Mendel Austria
• Island Trading Helen Bennett UK
• Laughing Bacchus Winecellars Yoshi Tannamuri Canada
• Magazzini Alimentari Riuniti Giovanni Rovelli Italy
Define an HTML Table
• A table in HTML consists of table cells inside rows and columns.
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
Table Cells
• Each table cell is defined by a <td> and a </td> tag.
• td stands for table data.
• Everything between <td> and </td> are the content of the table cell.
• <table>
• <tr>
• <td>Emil</td>
• <td>Tobias</td>
• <td>Linus</td>
• </tr>
• </table>
Note: A table cell can contain all sorts of HTML elements: text, images, lists, links, other tables, etc.
Table Rows
• Each table row starts with a <tr> and ends with a </tr> tag.
• tr stands for table row.
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
Table Headers
• Sometimes you want your cells to be table header cells. In those cases
use the <th> tag instead of the <td> tag:
• th stands for table header.
HTML Table Borders
• HTML tables can have borders of different styles and shapes.
How To Add a Border
• When you add a border to a table, you also add borders around each
table cell:
• To add a border, use the CSS border property on table, th, and td
elements:
• Example
table, th, td {
border: 1px solid black;
}
Style Table Borders
• If you set a background color of each cell, and give the border a white
color (the same as the document background), you get the impression
of an invisible border:
Example
table, th, td {
border: 1px solid white;
border-collapse: collapse;
}
th, td {
background-color: #96D4D4;
}
HTML Table Sizes
• HTML tables can have different sizes for each column, row or the
entire table.
• Use the style attribute with the width or height properties to specify
the size of a table, row or column.
HTML Table Width
• To set the width of a table, add the style attribute to the <table> element:
• <table style="width:100%">
• <tr>
• <th>Firstname</th>
• <th>Lastname</th>
• <th>Age</th>
• </tr>
• <tr>
• <td>Jill</td>
• <td>Smith</td>
• <td>50</td>
• </tr>
HTML Table Column Width
• To set the size of a specific column, add the style attribute on a <th> or <td> element:
• Example
Set the width of the first column to 70%:
<table style="width:100%">
<tr>
<th style="width:70%">Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
HTML Table Row Height
• To set the height of a specific row, add the style attribute on a table row element:
Example
Set the height of the second row to 200 pixels:
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr style="height:200px">
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
HTML Table Padding & Spacing
• HTML tables can adjust the padding inside the cells, and also the
space between the cells.
HTML Table- Cell Padding
• Cell padding is the space between the cell edges and the cell content.
• By default the padding is set to 0.
• To add padding on table cells, use the CSS padding property:
Example
th, td {
padding: 15px;
}
• To add padding only above the content, use the padding-top property.
• And the others sides with the padding-bottom, padding-left, and padding-right
properties:
Example
th, td {
padding-top: 10px;
padding-bottom: 20px;
padding-left: 30px;
padding-right: 40px;
}
HTML Table Colspan & Rowspan
• HTML tables can have cells that span over multiple rows and/or
columns.
HTML Table- Colspan
• To make a cell span over multiple columns, use the colspan attribute:
Example
<table>
<tr>
<th colspan="2">Name</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>43</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>57</td>
</tr>
</table>
HTML Table- Rowspan
• To make a cell span over multiple rows, use the rowspan attribute:
Example
<table>
<tr>
<th>Name</th>
<td>Jill</td>
</tr>
<tr>
<th rowspan="2">Phone</th>
<td>555-1234</td>
</tr>
<tr>
<td>555-8745</td>
</tr>
</table>
HTML Table Colgroup
• The <colgroup> element is used to style specific columns of a table.
• If you want to style the two first columns of a table, use the <colgroup> and <col> elements.
• The <colgroup> element should be used as a container for the column specifications.
• Each group is specified with a <col> element.
• The span attribute specifies how many columns that get the style.
• The style attribute specifies the style to give the columns.
• Note: There is a very limited selection of legal CSS properties for colgroups.
• Example
<table>
<colgroup>
<col span="2" style="background-color: #D6EEEE">
</colgroup>
<tr>
<th>MON</th>
<th>TUE</th>
<th>WED</th>
<th>THU</th>
• There is only a very limited selection of CSS properties that are
allowed to be used in the colgroup:
• width property
• visibility property
• background properties
• border properties
• All other CSS properties will have no effect on your tables.
Multiple Col Elements
• If you want to style more columns with different styles, use more <col> elements
inside the <colgroup>:
Example
<table>
<colgroup>
<col span="2" style="background-color: #D6EEEE">
<col span="3" style="background-color: pink">
</colgroup>
<tr>
<th>MON</th>
<th>TUE</th>
<th>WED</th>
<th>THU</th>
Empty Colgroups
• If you want to style columns in the middle of a table, insert a "empty" <col> element (with no
styles) for the columns before:
Example
<table>
<colgroup>
<col span="3">
<col span="2" style="background-color: pink">
</colgroup>
<tr>
<th>MON</th>
<th>TUE</th>
<th>WED</th>
<th>THU</th>
...
Ad

More Related Content

Similar to HTML Styles - Cascading Style Sheets Cascading Style Sheets (20)

Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
jeweltutin
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
M Ashraful Islam Jewel
 
Html Styles-CSS
Html Styles-CSSHtml Styles-CSS
Html Styles-CSS
ispkosova
 
Css
CssCss
Css
shinyduela
 
WT CSS
WT  CSSWT  CSS
WT CSS
Mohan186867
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
karthiksmart21
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptxcascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
Html tables
Html tablesHtml tables
Html tables
Sikandar Pandit
 
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
Unitegergergegegegetgegegegegegeg-2-CSS.pptxUnitegergergegegegetgegegegegegeg-2-CSS.pptx
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
VikasTuwar1
 
BITM3730Week4.pptx
BITM3730Week4.pptxBITM3730Week4.pptx
BITM3730Week4.pptx
MattMarino13
 
Css Basics
Css BasicsCss Basics
Css Basics
Jay Patel
 
Introduction to XML, XHTML and CSS
Introduction to XML, XHTML and CSSIntroduction to XML, XHTML and CSS
Introduction to XML, XHTML and CSS
Jussi Pohjolainen
 
CSS Topic wise Short notes ppt by Navya.E
CSS Topic wise Short notes ppt by Navya.ECSS Topic wise Short notes ppt by Navya.E
CSS Topic wise Short notes ppt by Navya.E
NavyaEnugala
 
Session on common html table
Session on common html tableSession on common html table
Session on common html table
Rahul Kumar
 
Html tables
Html tablesHtml tables
Html tables
Himanshu Pathak
 
CSS
CSSCSS
CSS
Jussi Pohjolainen
 
Episode 14 - Basics of HTML for Salesforce
Episode 14 - Basics of HTML for SalesforceEpisode 14 - Basics of HTML for Salesforce
Episode 14 - Basics of HTML for Salesforce
Jitendra Zaa
 
CSS
CSSCSS
CSS
Raja Kumar Ranjan
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
jeweltutin
 
Html Styles-CSS
Html Styles-CSSHtml Styles-CSS
Html Styles-CSS
ispkosova
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
karthiksmart21
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptxcascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
Unitegergergegegegetgegegegegegeg-2-CSS.pptxUnitegergergegegegetgegegegegegeg-2-CSS.pptx
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
VikasTuwar1
 
BITM3730Week4.pptx
BITM3730Week4.pptxBITM3730Week4.pptx
BITM3730Week4.pptx
MattMarino13
 
Introduction to XML, XHTML and CSS
Introduction to XML, XHTML and CSSIntroduction to XML, XHTML and CSS
Introduction to XML, XHTML and CSS
Jussi Pohjolainen
 
CSS Topic wise Short notes ppt by Navya.E
CSS Topic wise Short notes ppt by Navya.ECSS Topic wise Short notes ppt by Navya.E
CSS Topic wise Short notes ppt by Navya.E
NavyaEnugala
 
Session on common html table
Session on common html tableSession on common html table
Session on common html table
Rahul Kumar
 
Episode 14 - Basics of HTML for Salesforce
Episode 14 - Basics of HTML for SalesforceEpisode 14 - Basics of HTML for Salesforce
Episode 14 - Basics of HTML for Salesforce
Jitendra Zaa
 

More from JuliusECatipon (15)

sec.This includes policy settings that prevent unauthorized people
sec.This includes policy settings that prevent unauthorized peoplesec.This includes policy settings that prevent unauthorized people
sec.This includes policy settings that prevent unauthorized people
JuliusECatipon
 
What is 5S.The 5S concept might sound a little abstract
What is 5S.The 5S concept might sound a little abstractWhat is 5S.The 5S concept might sound a little abstract
What is 5S.The 5S concept might sound a little abstract
JuliusECatipon
 
Computer Organization and Architecture.pptx
Computer Organization and Architecture.pptxComputer Organization and Architecture.pptx
Computer Organization and Architecture.pptx
JuliusECatipon
 
Simply put, CBT is focused on achieving learning outcomes and equipping learn...
Simply put, CBT is focused on achieving learning outcomes and equipping learn...Simply put, CBT is focused on achieving learning outcomes and equipping learn...
Simply put, CBT is focused on achieving learning outcomes and equipping learn...
JuliusECatipon
 
WebClues system will improve communication and transparency
WebClues system will improve communication and transparencyWebClues system will improve communication and transparency
WebClues system will improve communication and transparency
JuliusECatipon
 
12 principles of good website design.docx
12 principles of good website design.docx12 principles of good website design.docx
12 principles of good website design.docx
JuliusECatipon
 
INFORMATION ASSURANCE AND SECURITY PRESENTATION
INFORMATION ASSURANCE AND SECURITY PRESENTATIONINFORMATION ASSURANCE AND SECURITY PRESENTATION
INFORMATION ASSURANCE AND SECURITY PRESENTATION
JuliusECatipon
 
What Are The Different Types Of Web Technologies.pptx
What Are The Different Types Of Web Technologies.pptxWhat Are The Different Types Of Web Technologies.pptx
What Are The Different Types Of Web Technologies.pptx
JuliusECatipon
 
What Is Management Information System (MIS).pptx
What Is Management Information System (MIS).pptxWhat Is Management Information System (MIS).pptx
What Is Management Information System (MIS).pptx
JuliusECatipon
 
Network Administration and Maintenace.pptx
Network Administration and Maintenace.pptxNetwork Administration and Maintenace.pptx
Network Administration and Maintenace.pptx
JuliusECatipon
 
Network_Cabling.ppt
Network_Cabling.pptNetwork_Cabling.ppt
Network_Cabling.ppt
JuliusECatipon
 
Web Technologies.pptx
Web Technologies.pptxWeb Technologies.pptx
Web Technologies.pptx
JuliusECatipon
 
Web Technologies.pptx
Web Technologies.pptxWeb Technologies.pptx
Web Technologies.pptx
JuliusECatipon
 
week 1 CS 3rdData, information and.pptx
week 1 CS 3rdData, information and.pptxweek 1 CS 3rdData, information and.pptx
week 1 CS 3rdData, information and.pptx
JuliusECatipon
 
Computer - Software.pptx
Computer - Software.pptxComputer - Software.pptx
Computer - Software.pptx
JuliusECatipon
 
sec.This includes policy settings that prevent unauthorized people
sec.This includes policy settings that prevent unauthorized peoplesec.This includes policy settings that prevent unauthorized people
sec.This includes policy settings that prevent unauthorized people
JuliusECatipon
 
What is 5S.The 5S concept might sound a little abstract
What is 5S.The 5S concept might sound a little abstractWhat is 5S.The 5S concept might sound a little abstract
What is 5S.The 5S concept might sound a little abstract
JuliusECatipon
 
Computer Organization and Architecture.pptx
Computer Organization and Architecture.pptxComputer Organization and Architecture.pptx
Computer Organization and Architecture.pptx
JuliusECatipon
 
Simply put, CBT is focused on achieving learning outcomes and equipping learn...
Simply put, CBT is focused on achieving learning outcomes and equipping learn...Simply put, CBT is focused on achieving learning outcomes and equipping learn...
Simply put, CBT is focused on achieving learning outcomes and equipping learn...
JuliusECatipon
 
WebClues system will improve communication and transparency
WebClues system will improve communication and transparencyWebClues system will improve communication and transparency
WebClues system will improve communication and transparency
JuliusECatipon
 
12 principles of good website design.docx
12 principles of good website design.docx12 principles of good website design.docx
12 principles of good website design.docx
JuliusECatipon
 
INFORMATION ASSURANCE AND SECURITY PRESENTATION
INFORMATION ASSURANCE AND SECURITY PRESENTATIONINFORMATION ASSURANCE AND SECURITY PRESENTATION
INFORMATION ASSURANCE AND SECURITY PRESENTATION
JuliusECatipon
 
What Are The Different Types Of Web Technologies.pptx
What Are The Different Types Of Web Technologies.pptxWhat Are The Different Types Of Web Technologies.pptx
What Are The Different Types Of Web Technologies.pptx
JuliusECatipon
 
What Is Management Information System (MIS).pptx
What Is Management Information System (MIS).pptxWhat Is Management Information System (MIS).pptx
What Is Management Information System (MIS).pptx
JuliusECatipon
 
Network Administration and Maintenace.pptx
Network Administration and Maintenace.pptxNetwork Administration and Maintenace.pptx
Network Administration and Maintenace.pptx
JuliusECatipon
 
week 1 CS 3rdData, information and.pptx
week 1 CS 3rdData, information and.pptxweek 1 CS 3rdData, information and.pptx
week 1 CS 3rdData, information and.pptx
JuliusECatipon
 
Computer - Software.pptx
Computer - Software.pptxComputer - Software.pptx
Computer - Software.pptx
JuliusECatipon
 
Ad

Recently uploaded (20)

AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Ad

HTML Styles - Cascading Style Sheets Cascading Style Sheets

  • 2. What is CSS? • CSS stands for Cascading Style Sheets. • CSS saves a lot of work. It can control the layout of multiple web pages all at once. • Cascading Style Sheets (CSS) is used to format the layout of a webpage. • With CSS, you can control the color, font, the size of text, the spacing between elements, how elements are positioned and laid out, what background images or background colors are to be used, different displays for different devices and screen sizes,
  • 3. Using CSS • CSS can be added to HTML documents in 3 ways: • Inline - by using the style attribute inside HTML elements • Internal - by using a <style> element in the <head> section • External - by using a <link> element to link to an external CSS file
  • 4. Inline CSS • An inline CSS is used to apply a unique style to a single HTML element. • An inline CSS uses the style attribute of an HTML element. • Example • <h1 style="color:blue;">A Blue Heading</h1> • <p style="color:red;">A red paragraph.</p>
  • 5. Internal CSS • An internal CSS is used to define a style for a single HTML page. • An internal CSS is defined in the <head> section of an HTML page, within a <style> element. <!DOCTYPE html> <html> <head> <style> body {background-color: powderblue;} h1 {color: blue;} p {color: red;} </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 6. External CSS • An external style sheet is used to define the style for many HTML pages • . Example <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="styles.css"> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 7. • The external style sheet can be written in any text editor. The file must not contain any HTML code, and must be saved with a .css extension. body { background-color: powderblue; } h1 { color: blue; } p { color: red; }
  • 8. CSS Colors, Fonts and Sizes • The CSS color property defines the text color to be used. • The CSS font-family property defines the font to be used. • The CSS font-size property defines the text size to be used.
  • 9. <!DOCTYPE html> <html> <head> <style> h1 { color: blue; font-family: verdana; font-size: 300%; } p { color: red; font-family: courier; font-size: 160%; } </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 10. CSS Border • The CSS border property defines a border around an HTML element. • Example • Use of CSS border property: • p { • border: 2px solid powderblue; • }
  • 11. CSS Padding • The CSS padding property defines a padding (space) between the text and the border. • Example • Use of CSS border and padding properties: • p { • border: 2px solid powderblue; • padding: 30px; • }
  • 12. CSS Margin • The CSS margin property defines a margin (space) outside the border. • Example • Use of CSS border and margin properties: • p { • border: 2px solid powderblue; • margin: 50px; • }
  • 13. Link to External CSS • External style sheets can be referenced with a full URL or with a path relative to the current web page. • Example • This example uses a full URL to link to a style sheet: • <link rel="stylesheet" href=“css/styles.css">
  • 14. • Use the HTML style attribute for inline styling • Use the HTML <style> element to define internal CSS • Use the HTML <link> element to refer to an external CSS file • Use the HTML <head> element to store <style> and <link> elements • Use the CSS color property for text colors • Use the CSS font-family property for text fonts • Use the CSS font-size property for text sizes • Use the CSS border property for borders • Use the CSS padding property for space inside the border • Use the CSS margin property for space outside the border
  • 15. HTML Tables • HTML tables allow web developers to arrange data into rows and columns. • Company Contact Country • Alfreds Futterkiste Maria Anders Germany • Centro comercial Moctezuma Francisco Chang Mexico • Ernst Handel Roland Mendel Austria • Island Trading Helen Bennett UK • Laughing Bacchus Winecellars Yoshi Tannamuri Canada • Magazzini Alimentari Riuniti Giovanni Rovelli Italy
  • 16. Define an HTML Table • A table in HTML consists of table cells inside rows and columns. <table> <tr> <th>Company</th> <th>Contact</th> <th>Country</th> </tr> <tr> <td>Alfreds Futterkiste</td> <td>Maria Anders</td> <td>Germany</td> </tr> <tr> <td>Centro comercial Moctezuma</td> <td>Francisco Chang</td> <td>Mexico</td> </tr> </table>
  • 17. Table Cells • Each table cell is defined by a <td> and a </td> tag. • td stands for table data. • Everything between <td> and </td> are the content of the table cell. • <table> • <tr> • <td>Emil</td> • <td>Tobias</td> • <td>Linus</td> • </tr> • </table> Note: A table cell can contain all sorts of HTML elements: text, images, lists, links, other tables, etc.
  • 18. Table Rows • Each table row starts with a <tr> and ends with a </tr> tag. • tr stands for table row. <table> <tr> <td>Emil</td> <td>Tobias</td> <td>Linus</td> </tr> <tr> <td>16</td> <td>14</td> <td>10</td> </tr> </table>
  • 19. Table Headers • Sometimes you want your cells to be table header cells. In those cases use the <th> tag instead of the <td> tag: • th stands for table header.
  • 20. HTML Table Borders • HTML tables can have borders of different styles and shapes.
  • 21. How To Add a Border • When you add a border to a table, you also add borders around each table cell:
  • 22. • To add a border, use the CSS border property on table, th, and td elements: • Example table, th, td { border: 1px solid black; }
  • 23. Style Table Borders • If you set a background color of each cell, and give the border a white color (the same as the document background), you get the impression of an invisible border: Example table, th, td { border: 1px solid white; border-collapse: collapse; } th, td { background-color: #96D4D4; }
  • 24. HTML Table Sizes • HTML tables can have different sizes for each column, row or the entire table. • Use the style attribute with the width or height properties to specify the size of a table, row or column.
  • 25. HTML Table Width • To set the width of a table, add the style attribute to the <table> element: • <table style="width:100%"> • <tr> • <th>Firstname</th> • <th>Lastname</th> • <th>Age</th> • </tr> • <tr> • <td>Jill</td> • <td>Smith</td> • <td>50</td> • </tr>
  • 26. HTML Table Column Width • To set the size of a specific column, add the style attribute on a <th> or <td> element: • Example Set the width of the first column to 70%: <table style="width:100%"> <tr> <th style="width:70%">Firstname</th> <th>Lastname</th> <th>Age</th> </tr> <tr> <td>Jill</td> <td>Smith</td> <td>50</td> </tr>
  • 27. HTML Table Row Height • To set the height of a specific row, add the style attribute on a table row element: Example Set the height of the second row to 200 pixels: <table style="width:100%"> <tr> <th>Firstname</th> <th>Lastname</th> <th>Age</th> </tr> <tr style="height:200px"> <td>Jill</td> <td>Smith</td> <td>50</td> </tr>
  • 28. HTML Table Padding & Spacing • HTML tables can adjust the padding inside the cells, and also the space between the cells.
  • 29. HTML Table- Cell Padding • Cell padding is the space between the cell edges and the cell content. • By default the padding is set to 0. • To add padding on table cells, use the CSS padding property: Example th, td { padding: 15px; }
  • 30. • To add padding only above the content, use the padding-top property. • And the others sides with the padding-bottom, padding-left, and padding-right properties: Example th, td { padding-top: 10px; padding-bottom: 20px; padding-left: 30px; padding-right: 40px; }
  • 31. HTML Table Colspan & Rowspan • HTML tables can have cells that span over multiple rows and/or columns.
  • 32. HTML Table- Colspan • To make a cell span over multiple columns, use the colspan attribute: Example <table> <tr> <th colspan="2">Name</th> <th>Age</th> </tr> <tr> <td>Jill</td> <td>Smith</td> <td>43</td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>57</td> </tr> </table>
  • 33. HTML Table- Rowspan • To make a cell span over multiple rows, use the rowspan attribute: Example <table> <tr> <th>Name</th> <td>Jill</td> </tr> <tr> <th rowspan="2">Phone</th> <td>555-1234</td> </tr> <tr> <td>555-8745</td> </tr> </table>
  • 34. HTML Table Colgroup • The <colgroup> element is used to style specific columns of a table. • If you want to style the two first columns of a table, use the <colgroup> and <col> elements. • The <colgroup> element should be used as a container for the column specifications. • Each group is specified with a <col> element. • The span attribute specifies how many columns that get the style. • The style attribute specifies the style to give the columns. • Note: There is a very limited selection of legal CSS properties for colgroups.
  • 35. • Example <table> <colgroup> <col span="2" style="background-color: #D6EEEE"> </colgroup> <tr> <th>MON</th> <th>TUE</th> <th>WED</th> <th>THU</th>
  • 36. • There is only a very limited selection of CSS properties that are allowed to be used in the colgroup: • width property • visibility property • background properties • border properties • All other CSS properties will have no effect on your tables.
  • 37. Multiple Col Elements • If you want to style more columns with different styles, use more <col> elements inside the <colgroup>: Example <table> <colgroup> <col span="2" style="background-color: #D6EEEE"> <col span="3" style="background-color: pink"> </colgroup> <tr> <th>MON</th> <th>TUE</th> <th>WED</th> <th>THU</th>
  • 38. Empty Colgroups • If you want to style columns in the middle of a table, insert a "empty" <col> element (with no styles) for the columns before: Example <table> <colgroup> <col span="3"> <col span="2" style="background-color: pink"> </colgroup> <tr> <th>MON</th> <th>TUE</th> <th>WED</th> <th>THU</th> ...