All Questions

1326
votes
35answers
2064135 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...
313
votes
24answers
191188 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...
747
votes
32answers
181307 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...
1537
votes
21answers
336291 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?
38
votes
1answers
43487 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...
3231
votes
78answers
3135039 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
410449 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 ...
1585
votes
19answers
856366 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...
2016
votes
27answers
1880145 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?
58
votes
1answers
4450 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...

Previous Next