All Questions

994
votes
8answers
315437 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? ~ ! @ $ % ^ & * ( ) + = , . / ' ; : " ? > < ...
1611
votes
33answers
2404165 views

How do I vertically center text with CSS?

I have a div element which contains text, and I want to align the contents of this div vertically center. Here is my div style: #box { height: 170px; width: 270px; background: #000; ...
90
votes
7answers
56380 views

How to Create Grid/Tile View?

For example, I have some class .article, and I want to view this class as grid view. So I applied this style: .article{ width:100px; height:100px; background:#333; float:left; margin:5px; }...
711
votes
29answers
543322 views

How can I make Bootstrap columns all the same height?

I'm using Bootstrap. How can I make three columns all the same height? Here is a screenshot of the problem. I would like the blue and red columns to be the same height as the yellow column. Here ...
790
votes
28answers
433052 views

What methods of ‘clearfix’ can I use?

I have the age-old problem of a div wrapping a two-column layout. My sidebar is floated, so my container div fails to wrap the content and sidebar. <div id="container"> <div id="content"&g...
4067
votes
33answers
1329498 views

How to disable text selection highlighting?

For anchors that act like buttons (for example, Questions, Tags, Users, etc. at the top of the Stack Overflow page) or tabs, is there a CSS standard way to disable the highlighting effect if the ...
1891
votes
26answers
1468633 views

How do I give text or an image a transparent background using CSS?

Is it possible, using CSS only, to make the background of an element semi-transparent but have the content (text & images) of the element opaque? I'd like to accomplish this without having the te...
712
votes
17answers
292042 views

Maintain the aspect ratio of a div with CSS

I want to create a div that can change its width/height as the window's width changes. Are there any CSS3 rules that would allow the height to change according to the width, while maintaining its asp...
820
votes
10answers
542720 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 c...
623
votes
15answers
646718 views

CSS selector for first element with class

I have a bunch of elements with a class name red, I can't seem to select the first element with the class="red" using the following CSS rule: .red:first-child{ border:5px solid red; ...

Previous Next