All Questions

1325
votes
35answers
2120534 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...
328
votes
24answers
201646 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...
766
votes
32answers
187325 views

How to remove the space between inline-block elements?

Given this HTML & CSS: span { display:inline-block; width:100px; background-color:palevioletred; } <p> <span> Foo </span> <span> Bar </s...
1565
votes
21answers
344546 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?
42
votes
1answers
48711 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...
3317
votes
79answers
3228854 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
415778 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 ...
1636
votes
18answers
892372 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...
67
votes
1answers
5864 views

Why doesn't flex item shrink past content size?

I have 4 flexbox columns and everything works fine, but when I add some text to column and set it to a big font size, it is making the column wider than it should be due to flexbox setting. I tried t...
2085
votes
29answers
1937785 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