Skip to main content
2283 votes
36 answers
3.9m views

RegEx match open tags except XHTML self-contained tags

I need to match all of these opening tags: <p> <a href="foo"> But not self-closing tags: <br /> <hr class="foo" /> I came up with this and wanted to make ...
1523 votes
12 answers
168k views

Why don't self-closing script elements work?

What is the reason browsers do not correctly recognize: <script src="foobar.js" /> <!-- self-closing script element --> Only this is recognized: <script src="foobar.js"></...
dimarzionist's user avatar
  • 18.6k
972 votes
15 answers
390k views

When is a CDATA section necessary within a script tag?

Are CDATA tags ever necessary in script tags and if so when? In other words, when and where is this: <script type="text/javascript"> //<![CDATA[ ...code... //]]> </script> ...
brad's user avatar
  • 75.2k
940 votes
25 answers
540k views

What's the difference between <b> and <strong>, <i> and <em>?

What's the difference between <b> and <strong>, <i> and <em> in HTML/XHTML? When should you use each?
Philip Morton's user avatar
660 votes
7 answers
223k views

Can we have multiple <tbody> in same <table>?

Can we have multiple <tbody> tags in same <table>? If yes then in what scenarios should we use multiple <tbody> tags?
Jitendra Vyas's user avatar
614 votes
33 answers
821k views

Make a div into a link

I have a <div> block with some fancy visual content that I don't want to change. I want to make it a clickable link. I'm looking for something like <a href="…"><div> … </div>&...
EE.'s user avatar
  • 6,241
520 votes
18 answers
242k views

Margin on child element moves parent element

I have a div (parent) that contains another div (child). Parent is the first element in body with no particular CSS style. When I set .child { margin-top: 10px; } The end result is that top of ...
Robert Koritnik's user avatar
370 votes
21 answers
492k views

Can an HTML element have multiple ids?

I understand that an id must be unique within an HTML/XHTML page. For a given element, can I assign multiple ids to it? <div id="nested_element_123 task_123"></div> I realize I ...
webmat's user avatar
  • 60.1k
349 votes
6 answers
326k views

How do I properly escape quotes inside HTML attributes?

I have a drop down on a web page which is breaking when the value string contains a quote. The value is "asd, but in the DOM it always appears as an empty string. I have tried every way I know to ...
Chris's user avatar
  • 3,782
304 votes
33 answers
409k views

Add centered text to the middle of a horizontal rule [duplicate]

I'm wondering what options one has in xhtml 1.0 strict to create a line on both sides of text like-so: Section one ----------------------- Next section ----------------------- Section two I've ...
Brian M. Hunt's user avatar
299 votes
8 answers
480k views

How do I link to part of a page? (hash?)

How do you link (with <a>) so that the browser goes to certain subheading on the target page as opposed to the top?
Haroldo's user avatar
  • 37.2k
298 votes
14 answers
596k views

Tick symbol in HTML/XHTML

We need to display a tick symbol (✓ or ✔) within an internal web app and would ideally like to avoid using an image. Has to work starting with IE 6.0.2900 on a XP box, ideally we need ...
Vlad Gudim's user avatar
  • 23.5k
285 votes
22 answers
467k views

HTML list-style-type dash

Is there a way to create a list-style in HTML with a dash (i.e. - or – &ndash; or — &mdash;) i.e. <ul> <li>abc</li> </ul> Outputting: - abc It's ...
Brian M. Hunt's user avatar
271 votes
17 answers
272k views

Replacing H1 text with a logo image: best method for SEO and accessibility?

It seems like there are a few different techniques out there, so I was hoping to get a "definitive" answer on this... On a website, it's common practice to create a logo that links to the homepage. I ...
Andrew's user avatar
  • 237k
262 votes
15 answers
65k views

Custom attributes - Yea or nay?

Recently I have been reading more and more about people using custom attributes in their HTML tags, mainly for the purpose of embedding some extra bits of data for use in javascript code. I was ...
TM.'s user avatar
  • 110k

15 30 50 per page
1
2 3 4 5
449