Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey
2322 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 ...
573 votes
30 answers
554k 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 = '[email protected]'; $subject = 'Customer ...
user3818620's user avatar
  • 5,773
2323 votes
32 answers
481k views

How do you parse and process HTML/XML in PHP?

How can one parse HTML/XML and extract information from it?
1296 votes
41 answers
512k views

How to remove the space between inline/inline-block elements?

There will be a 4 pixel wide space between these span elements: span { display: inline-block; width: 100px; background-color: palevioletred; } <p> <span> Foo </span> &...
Šime Vidas's user avatar
5102 votes
128 answers
5.0m views

How can I horizontally center an element?

How can I horizontally center a <div> within another <div> using CSS? <div id="outer"> <div id="inner">Foo foo</div> </div>
995 votes
14 answers
1.8m views

Flexbox: center horizontally and vertically

How to center div horizontally, and vertically within the container using flexbox. In below example, I want each number below each other (in rows), which are centered horizontally. .flex-container ...
bsr's user avatar
  • 58.8k
590 votes
7 answers
202k 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 ...
tomas657's user avatar
  • 6,009
260 votes
4 answers
94k views

CSS-only masonry layout

I need to implement a masonry layout. However, for a number of reasons I don't want to use JavaScript to do it. Parameters: All elements have the same width Elements have a height that cannot be ...
Pekka's user avatar
  • 450k
1685 votes
50 answers
1.9m views

How can I vertically center a div element for all browsers using CSS?

I want to center a div vertically with CSS. I don't want tables or JavaScript, but only pure CSS. I found some solutions, but all of them are missing Internet Explorer 6 support. <body> <...
Burak Erdem's user avatar
2310 votes
27 answers
567k views

HTML: Valid id attribute values?

When creating the id attributes for HTML elements, what rules are there for the value?
Mr Shark's user avatar
  • 26.5k
756 votes
10 answers
240k views

Image inside div has extra space below the image

Why in the following code the height of the div is bigger than the height of the img ? There is a gap below the image, but it doesn't seems to be a padding/margin. What is the gap or extra space ...
Misha Moroshko's user avatar
5470 votes
78 answers
4.9m views

How can I validate an email address in JavaScript?

I'd like to check if the user input is an email address in JavaScript, before sending it to a server or attempting to send an email to it, to prevent the most basic mistyping. How could I achieve this?...
1092 votes
31 answers
2.1m views

How can I vertically align elements in a div?

I have a div with two images and an h1. All of them need to be vertically aligned within the div, next to each other. One of the images needs to be absolute positioned within the div. What is the CSS ...
Abdu's user avatar
  • 16.6k
1249 votes
31 answers
2.7m views

How can I center text (horizontally and vertically) inside a div block?

I have a div set to display:block (90px height and width), and I have some text inside. I need the text to be aligned in the center both vertically and horizontally. I have tried text-align:center, ...
Satch3000's user avatar
  • 49.5k
1089 votes
10 answers
717k views

What is a clearfix?

Recently I was looking through some website's code, and saw that every <div> had a class clearfix. After a quick Google search, I learned that it is for IE6 sometimes, but what actually is a ...
H Bellamy's user avatar
  • 22.8k

15 30 50 per page
1
2 3 4 5
5397