Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6078245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:48:41+00:00 2026-05-23T10:48:41+00:00

Attribute quotes are optional in HTML5 . What are the pros/cons to quoting them?

  • 0

Attribute quotes are optional in HTML5.

What are the pros/cons to quoting them?

id=example                     <!--quotes optional-->
href=http://example.com        <!--quotes optional-->
class="example example-1"      <!--quotes required due to space-->
href="http://example.com/p=47" <!--quotes required due to '=' sign-->

Update: Added advantages based on the answers:

Advantages to quoting all attributes:

  • all editors can deal with it properly
  • more consistent
  • better portability (easier to change doctype)
  • easier to maintain (esp. if attributes might become empty)
  • easier to ‘find and replace’ changes
  • cleaner doc (if you think quotes improve readability)
  • ?

Advantages to omitting optional quotes:

  • slightly reduced filesize
  • cleaner doc (if you prefer minimal text)
  • ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:48:41+00:00Added an answer on May 23, 2026 at 10:48 am

    I’m in favour of always using quotes.

    • It looks way cleaner and more consistent

    • All editors can deal with it properly

    • It’s easier to maintain – you can edit values without breaking them because quotes are missing.

    The few bytes you save in document size by dropping quotes where they are not needed are not worth mentioning (unless maybe you’re Google’s home page).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MSDN says http://msdn.microsoft.com/en-us/library/ms256086.aspx degree[@from != Harvard] - All elements where the from attribute is
In XHTML 1.0 Strict do attribute values need to be surrounded with quotes? Example:
I have a WCF service. URL is: http://iphone.clickcelltest.com/EduLink.svc/GetLevel Methods have following attribute: [WebGet(ResponseFormat=WebMessageFormat.Json)] I
I have a custom attribute which can be assigned to a class, [FooAttribute] .
How can I write single and double quotes in the value attribute of h:outputText
Is it acceptable to use single quotes around html attribute values like this: <span
How do I escape double quotes in an event handler in HTML? For example,
When I have quotes that are not in an attribute do I need to
Do I need to escape quotes inside of an html attribute value? What characters
I've heard that using single quotes to surround XML attribute values is a bad

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.