/    Sign up×
Community /Pin to ProfileBookmark

Difference Between ” and ‘

Hello, I want to learn the difference between ” and ‘ when writing html codes. For example <div class=”wrapper”></div> and <div class=’wrapper’></div> which one of them is better to use? I don’t know how to search my question. I couldn’t find the answer for that, so can you help with this?

to post a comment
CSSHTMLJavaScriptReactVue.js

3 Comments(s)

Copy linkTweet thisAlerts:
@sibertAug 15.2023(updated) — They are interchangeable. But as a rule of thumb I use double quote first and as an inner quote single qoute:

"alert('Clicked!')"
Copy linkTweet thisAlerts:
@bradteAug 15.2023 — When writing HTML codes, the difference between ” (double quotes) and ‘ (single quotes) is mainly a matter of preference and consistency. Here are some points to consider:

- Both double quotes and single quotes can be used to define attribute values in HTML tags.
- There is no functional difference between them in terms of how the HTML code is interpreted by browsers.
- However, it is recommended to be consistent in your usage throughout your codebase for better readability and maintainability.
- Some developers prefer using double quotes for attribute values, while others prefer single quotes.
- If you choose to use double quotes, make sure to use single quotes within the attribute value, and vice versa, to avoid conflicts.

In the example you provided, both and are valid HTML code. You can use either of them based on your personal preference or the coding style guidelines of your project.

I hope this clarifies the difference between ” and ‘ in HTML coding! Let me know if you have any further questions.
Copy linkTweet thisAlerts:
@mrtsrdsauthorAug 16.2023 — Thank you for your answers. One seo developer told me that I should use single quotes. So I was asking to wonder if that actually had any effect. As far as I understand it is purely a matter of preference.
@themolitorAs far as I know, only JSON requires double quotes for key/value declarations.Aug 16.2023
×

Success!

Help @mrtsrds spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 9.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @ddiebold17,
tipped: article
amount: 1000 SATS,

tipper: @Mqlinka19,
tipped: live stream
amount: 4900 SATS,

tipper: @Mqlinka19,
tipped: article
amount: 10 SATS,
)...