All Questions

1325
votes
35answers
2149922 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 these: <br /> <hr class="foo" /> I came up with this and wanted to make sure I've got it right. I am...
333
votes
24answers
206534 views

PHP mail function doesn't complete sending of e-mail

<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'Customer Inqu...
781
votes
33answers
190531 views

How do I remove the space between inline-block elements?

Given this HTML and CSS: span { display:inline-block; width:100px; background-color:palevioletred; } <p> <span> Foo </span> <span> Bar </span...
1586
votes
21answers
348884 views

What are valid values for the id attribute in HTML?

When creating the id attributes for HTML elements, what rules are there for the value?
44
votes
1answers
50774 views

Servlet returns "HTTP Status 404 The requested resource (/servlet) is not available"

I have an HTML form in a JSP file in my WebContent/jsps folder. I have a servlet class servlet.java in my default package in src folder. In my web.xml it is mapped as /servlet. I have tried several U...
3358
votes
80answers
3271200 views

How to horizontally center a <div> in another <div>?

How can I horizontally center a <div> within another <div> using CSS (if it's even possible)? <div id="outer"> <div id="inner">Foo foo</div> </div>
665
votes
66answers
418354 views

Why not use tables for layout in HTML?

It seems to be the general opinion that tables should not be used for layout in HTML. Why? I have never (or rarely to be honest) seen good arguments for this. The usual answers are: It's good to ...
1655
votes
18answers
911434 views

Modify the URL without reloading the page

Is there any way I can modify the URL of the current page without reloading the page? I would like to access the portion before the # hash if possible. I only need to change the portion after the do...
76
votes
1answers
6654 views

Why don't flex items shrink past content size?

I have 4 flexbox columns and everything works fine, but when I add some text to a column and set it to a big font size, it is making the column wider than it should be due to the flex property. I tri...
2112
votes
29answers
1966882 views

Change an element's class with JavaScript

How can I change a class of an HTML element in response to an onClick event using JavaScript?

Previous Next