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

  • SEARCH
  • Home
  • 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 6533881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:11:00+00:00 2026-05-25T10:11:00+00:00

e.g.: a[href=val] Does val need to have quotes around it? Single or double are

  • 0

e.g.:

a[href="val"]

Does “val” need to have quotes around it? Single or double are acceptable? What about for integers?

  • 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-25T10:11:01+00:00Added an answer on May 25, 2026 at 10:11 am

    TLDR: Quotes are required unless the value meets the identifier specification for CSS2.1

    The CSS spec might say they are optional, but the real world presents a different story. When making a comparison against the href attribute you will need to use quotes (single or double work in my very limited testing – latest versions of FF, IE, Chrome.)

    Interestingly enough the css spec link referenced by @Pekka happens to use quotes around their href-specific examples.

    And it’s not just due to non-alpha characters like the period or slashes that give this unique situation a quote requirement – using a partial match selector ~= doesn’t work if you just use the “domain” in “domain.com”

    Ok, every answer here is wrong (including my own previous answer.) The CSS2 spec didn’t clarify whether quotes are required in the selector section itself, but the CSS3 spec does and quotes the rule as a CSS21 implementation:

    http://www.w3.org/TR/css3-selectors/

    Attribute values must be CSS identifiers or strings. [CSS21] The case-sensitivity of attribute names and values in selectors depends on the document language.

    And here is the identifier info:

    http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier

    In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier “B&W?” may be written as “B\&W\?” or “B\26 W\3F”.

    My answer seemed correct but that’s because the ‘~=’ is a white-space selector comparator so it will never match a partial string inside an href value. A ‘*=’ comparator does work however. And a partial string like ‘domain’ does work for matching href=’www.domain.com’. But checking for a full domain name would not work because it violates the identifier rule.

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

Sidebar

Related Questions

I have an anchor tag that has an href. I need to add a
I have a input button that has an href. I need to add a
var tagMatch; if (tagMatch = window.location.href.match(/\/questions\/ask\?tags=([^&]+)/)) { $(function() { if (!$('#tagnames').val().length) { $('#tagnames').val(unescape(match[1].replace(/\+/g, '
I have an href in HTML that I dynamically produce from a server. I
I have a href link and I would like it to be clicked when
I need to use href instead click event so I can use hover in
I have this href link with text either attivo or non attivo User can
I have used href link in the flexigrid rows. on Click it takes me
I need to change a couple of href parameters using jQuery and driven by
I have to use <base href=http://www.mysite.com/it//> on my site because I am using apache

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.