All Questions

2181
votes
25answers
1240872 views

Is there a CSS parent selector?

How do I select the <li> element that is a direct parent of the anchor element? In example my CSS would be something like this: li < a.active { property: value; } Obviously there are ...
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...
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 ...
883
votes
12answers
382237 views

Is there a "previous sibling" CSS selector?

+ is for the next sibling. Is there an equivalent for the previous sibling?
87
votes
1answers
3731 views

Example images for code and mark-up Q&As

When preparing an MCVE/SSCCE that involves images, it is useful to have direct access to images. The types of images that would cover most questions are - small images in multiple colors or shapes,...
273
votes
4answers
48536 views

In CSS Flexbox, why are there no "justify-items" and "justify-self" properties?

Consider the main axis and cross axis of a flex container:                        &...
682
votes
18answers
419619 views

Selecting and manipulating CSS pseudo-elements such as ::before and ::after using jQuery

Is there any way to select/manipulate CSS pseudo-elements such as ::before and ::after (and the old version with one semi-colon) using jQuery? For example, my stylesheet has the following rule: .spa...
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...
972
votes
8answers
307432 views

Which characters are valid in CSS class names/selectors?

What characters/symbols are allowed within CSS class selectors? I know that the following characters are invalid, but what characters are valid? ~ ! @ $ % ^ & * ( ) + = , . / ' ; : " ? > < ...

Previous Next