SlideShare a Scribd company logo
Attributes provide additional information about HTML elements.
By:
Muhammad Toqeer Iqbal
Toqeer.94@gmail.com
HTML Attributes
All HTML elements can have attributes
Attributes provide additional information about an element
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name="value"
The href Attribute
HTML links are defined with the <a> tag. The link address is specified in
the href attribute:
You will learn more about links and the <a> tag later in this tutorial.
<a href="https://www.google.com">This is a link</a>
The src Attribute
HTML images are defined with the <img> tag.
The filename of the image source is specified in the src attribute:
<img src="img.jpg">
The width and height Attributes
Images in HTML have a set of size attributes, which specifies the width
and height of the image:
The image size is specified in pixels: width="500" means 500 pixels wide.
<img src="img.jpg" width="500" height="600">
The alt Attribute
The alt attribute specifies an alternative text to be used, when an image
cannot be displayed.
The value of the attribute can be read by screen readers. This way,
someone "listening" to the webpage, e.g. a blind person, can "hear" the
element.
<img src="img_girl.jpg" alt="Girl with a jacket">
The alt attribute is also useful if the image does not exist:
The style Attribute
The style attribute is used to specify the styling of an element, like color,
font, size etc.
<p style="color:red;">I am a paragraph</p>
The lang Attribute
The language of the document can be declared in the <html> tag.
The language is declared with the lang attribute.
Declaring a language is important for accessibility applications (screen
readers) and search engines:
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
The first two letters specify the language
(en). If there is a dialect, use two more
letters (US).
The title Attribute
Here, a title attribute is added to the <p> element. The value of the title
attribute will be displayed as a tooltip when you mouse over the
paragraph:
<p title="I'm a tooltip“>This is a paragraph.</p>
Use Lowercase Attributes
The HTML5 standard does not require lowercase attribute names.
The title attribute can be written with uppercase or lowercase
like title or TITLE.
W3C recommends lowercase in HTML, and demands lowercase for
stricter document types like XHTML.
Quote Attribute Values
The HTML5 standard does not require quotes around attribute values.
The href attribute, demonstrated above, can be written as:
W3C recommends quotes in HTML, and demands quotes for stricter
document types like XHTML.
Sometimes it is necessary to use quotes. This example will not display
the title attribute correctly, because it contains a space:
<a href=https://www.google.com>
<p title=About Google>
• Using quotes are the most common.
Omitting quotes can produce errors.
Single or Double Quotes?
Double quotes around attribute values are the most common in HTML,
but single quotes can also be used.
In some situations, when the attribute value itself contains double
quotes, it is necessary to use single quotes:
<p title='John "ShotGun" Nelson'> <p title="John 'ShotGun' Nelson">

More Related Content

What's hot

Sgml
SgmlSgml
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Basic Html Knowledge for students
Basic Html Knowledge for studentsBasic Html Knowledge for students
Basic Html Knowledge for students
vethics
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
eShikshak
 
Web Development using HTML & CSS
Web Development using HTML & CSSWeb Development using HTML & CSS
Web Development using HTML & CSS
Brainware Consultancy Pvt Ltd
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Ravinder Kamboj
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
MayaLisa
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
Shawn Calvert
 
Css Ppt
Css PptCss Ppt
Css Ppt
Hema Prasanth
 
Html
HtmlHtml
Html
HtmlHtml
presentation in html,css,javascript
presentation in html,css,javascriptpresentation in html,css,javascript
presentation in html,css,javascript
FaysalAhammed5
 
Validation Controls in asp.net
Validation Controls in asp.netValidation Controls in asp.net
Validation Controls in asp.net
Deep Patel
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
Ferdous Mahmud Shaon
 
HTML Text formatting tags
HTML Text formatting tagsHTML Text formatting tags
HTML Text formatting tags
Himanshu Pathak
 
Basic html tags
Basic html tagsBasic html tags
Basic html tags
Himanshu Pathak
 
Css ppt
Css pptCss ppt
Css ppt
Nidhi mishra
 
Css selectors
Css selectorsCss selectors
Css selectors
Dinesh Kumar
 
Html text and formatting
Html text and formattingHtml text and formatting
Html text and formatting
eShikshak
 
CSS notes
CSS notesCSS notes
CSS notes
Rajendra Prasad
 

What's hot (20)

Sgml
SgmlSgml
Sgml
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Basic Html Knowledge for students
Basic Html Knowledge for studentsBasic Html Knowledge for students
Basic Html Knowledge for students
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Web Development using HTML & CSS
Web Development using HTML & CSSWeb Development using HTML & CSS
Web Development using HTML & CSS
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
Html
HtmlHtml
Html
 
Html
HtmlHtml
Html
 
presentation in html,css,javascript
presentation in html,css,javascriptpresentation in html,css,javascript
presentation in html,css,javascript
 
Validation Controls in asp.net
Validation Controls in asp.netValidation Controls in asp.net
Validation Controls in asp.net
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
HTML Text formatting tags
HTML Text formatting tagsHTML Text formatting tags
HTML Text formatting tags
 
Basic html tags
Basic html tagsBasic html tags
Basic html tags
 
Css ppt
Css pptCss ppt
Css ppt
 
Css selectors
Css selectorsCss selectors
Css selectors
 
Html text and formatting
Html text and formattingHtml text and formatting
Html text and formatting
 
CSS notes
CSS notesCSS notes
CSS notes
 

Similar to 2. html attributes

HTML 5 Topic 2
HTML 5 Topic 2HTML 5 Topic 2
HTML 5 Topic 2
Juvywen
 
HTML Attributes.pptx
HTML Attributes.pptxHTML Attributes.pptx
HTML Attributes.pptx
Steins18
 
Html.docx
Html.docxHtml.docx
Html.docx
Noman Ali
 
Computer application html
Computer application htmlComputer application html
Computer application html
PrashantChahal3
 
AttributesL3.pptx
AttributesL3.pptxAttributesL3.pptx
AttributesL3.pptx
KrishRaj48
 
HTML Training Part1
HTML Training Part1HTML Training Part1
HTML Training Part1
than sare
 
HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
Akhilapatil4
 
HTML.pptx
HTML.pptxHTML.pptx
Html basics
Html basicsHtml basics
Html basics
wakeel132
 
HTML - part 1
HTML - part 1HTML - part 1
HTML - part 1
Fahad Masood
 
Html basic
Html basicHtml basic
Html basic
Viccky Khairnar
 
Html tutorials-infotech aus
Html tutorials-infotech ausHtml tutorials-infotech aus
Html tutorials-infotech aus
Nilesh Pujara
 
Html Workshop
Html WorkshopHtml Workshop
Html Workshop
vardanyan99
 
Introduction to Html
Introduction to HtmlIntroduction to Html
Introduction to Html
Folasade Adedeji
 
Higher Computing Science HTML
Higher Computing Science HTMLHigher Computing Science HTML
Higher Computing Science HTML
Forrester High School
 
HTML FOR BEGINNERS AND FOR PRACTICE .pdf
HTML FOR BEGINNERS AND FOR PRACTICE .pdfHTML FOR BEGINNERS AND FOR PRACTICE .pdf
HTML FOR BEGINNERS AND FOR PRACTICE .pdf
Arun Karthik
 
Html
HtmlHtml
Html
HtmlHtml
Html
HtmlHtml
Computer fundamentals-internet p2
Computer fundamentals-internet p2Computer fundamentals-internet p2
Computer fundamentals-internet p2
Leo Mark Villar
 

Similar to 2. html attributes (20)

HTML 5 Topic 2
HTML 5 Topic 2HTML 5 Topic 2
HTML 5 Topic 2
 
HTML Attributes.pptx
HTML Attributes.pptxHTML Attributes.pptx
HTML Attributes.pptx
 
Html.docx
Html.docxHtml.docx
Html.docx
 
Computer application html
Computer application htmlComputer application html
Computer application html
 
AttributesL3.pptx
AttributesL3.pptxAttributesL3.pptx
AttributesL3.pptx
 
HTML Training Part1
HTML Training Part1HTML Training Part1
HTML Training Part1
 
HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
 
HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
 
Html basics
Html basicsHtml basics
Html basics
 
HTML - part 1
HTML - part 1HTML - part 1
HTML - part 1
 
Html basic
Html basicHtml basic
Html basic
 
Html tutorials-infotech aus
Html tutorials-infotech ausHtml tutorials-infotech aus
Html tutorials-infotech aus
 
Html Workshop
Html WorkshopHtml Workshop
Html Workshop
 
Introduction to Html
Introduction to HtmlIntroduction to Html
Introduction to Html
 
Higher Computing Science HTML
Higher Computing Science HTMLHigher Computing Science HTML
Higher Computing Science HTML
 
HTML FOR BEGINNERS AND FOR PRACTICE .pdf
HTML FOR BEGINNERS AND FOR PRACTICE .pdfHTML FOR BEGINNERS AND FOR PRACTICE .pdf
HTML FOR BEGINNERS AND FOR PRACTICE .pdf
 
Html
HtmlHtml
Html
 
Html
HtmlHtml
Html
 
Html
HtmlHtml
Html
 
Computer fundamentals-internet p2
Computer fundamentals-internet p2Computer fundamentals-internet p2
Computer fundamentals-internet p2
 

Recently uploaded

“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
Fwdays
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
From Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMsFrom Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMs
Sease
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 

Recently uploaded (20)

“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
From Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMsFrom Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMs
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 

2. html attributes

  • 1. Attributes provide additional information about HTML elements. By: Muhammad Toqeer Iqbal Toqeer.94@gmail.com
  • 2. HTML Attributes All HTML elements can have attributes Attributes provide additional information about an element Attributes are always specified in the start tag Attributes usually come in name/value pairs like: name="value"
  • 3. The href Attribute HTML links are defined with the <a> tag. The link address is specified in the href attribute: You will learn more about links and the <a> tag later in this tutorial. <a href="https://www.google.com">This is a link</a>
  • 4. The src Attribute HTML images are defined with the <img> tag. The filename of the image source is specified in the src attribute: <img src="img.jpg">
  • 5. The width and height Attributes Images in HTML have a set of size attributes, which specifies the width and height of the image: The image size is specified in pixels: width="500" means 500 pixels wide. <img src="img.jpg" width="500" height="600">
  • 6. The alt Attribute The alt attribute specifies an alternative text to be used, when an image cannot be displayed. The value of the attribute can be read by screen readers. This way, someone "listening" to the webpage, e.g. a blind person, can "hear" the element. <img src="img_girl.jpg" alt="Girl with a jacket"> The alt attribute is also useful if the image does not exist:
  • 7. The style Attribute The style attribute is used to specify the styling of an element, like color, font, size etc. <p style="color:red;">I am a paragraph</p>
  • 8. The lang Attribute The language of the document can be declared in the <html> tag. The language is declared with the lang attribute. Declaring a language is important for accessibility applications (screen readers) and search engines: <!DOCTYPE html> <html lang="en-US"> <body> ... </body> </html> The first two letters specify the language (en). If there is a dialect, use two more letters (US).
  • 9. The title Attribute Here, a title attribute is added to the <p> element. The value of the title attribute will be displayed as a tooltip when you mouse over the paragraph: <p title="I'm a tooltip“>This is a paragraph.</p>
  • 10. Use Lowercase Attributes The HTML5 standard does not require lowercase attribute names. The title attribute can be written with uppercase or lowercase like title or TITLE. W3C recommends lowercase in HTML, and demands lowercase for stricter document types like XHTML.
  • 11. Quote Attribute Values The HTML5 standard does not require quotes around attribute values. The href attribute, demonstrated above, can be written as: W3C recommends quotes in HTML, and demands quotes for stricter document types like XHTML. Sometimes it is necessary to use quotes. This example will not display the title attribute correctly, because it contains a space: <a href=https://www.google.com> <p title=About Google> • Using quotes are the most common. Omitting quotes can produce errors.
  • 12. Single or Double Quotes? Double quotes around attribute values are the most common in HTML, but single quotes can also be used. In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes: <p title='John "ShotGun" Nelson'> <p title="John 'ShotGun' Nelson">