6,728
questions
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"></...
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>
...
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?
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?
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>&...
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 ...
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 ...
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 ...
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 ...
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?
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 ...
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 – – or — —) i.e.
<ul>
<li>abc</li>
</ul>
Outputting:
- abc
It's ...
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 ...
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 ...