Tag: r

61 votes
30 answers
615 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 CSS

avatar
Lorenzo
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
2.1K views
How to make Twitter Bootstrap menu dropdown on hover rather than click

I'd like to have my Bootstrap menu automatically drop down on hover, rather than having to click the menu

avatar
Rudolf
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
1.9K views
How can I center an absolutely positioned element in a div?

I need to place a div (with position:absolute;) element in the center of my window. But I am having problems d

avatar
Virgil
0 1 0 9
asked 07 September, 2021
50 votes
10 answers
2.2K views
Which characters are valid in CSS class names/selectors?

What characters/symbols are allowed within the CSS class selectors? I know that the following characters are i

avatar
Scot
0 1 0 9
asked 07 September, 2021
54 votes
27 answers
2.4K views
How to align content of a div to the bottom

Say I have the following CSS and HTML code: #header { height: 150px; } <div id="header"> &l

avatar
Wei
0 1 0 9
asked 07 September, 2021
64 votes
19 answers
1.7K views
How do I combine a background-image and CSS3 gradient on the same element?

How do I use CSS3 gradients for my background-color and then apply a background-image to apply some sort of li

avatar
Jesenia
0 1 0 9
asked 07 September, 2021
56 votes
30 answers
640 views
Font scaling based on width of container

I'm having a hard time getting my head around font scaling. I currently have a website with a body font-

avatar
Elicia
0 1 0 9
asked 07 September, 2021
64 votes
30 answers
2.8K 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

avatar
Lawanda
0 1 0 9
asked 07 September, 2021
67 votes
23 answers
717 views
Is there a "previous sibling" selector?

The plus sign (+) is for selecting the next sibling. Is there an equivalent for the previous sibling?

avatar
Solomon
0 1 0 9
asked 07 September, 2021
46 votes
30 answers
3K views
How to vertically align an image inside a div

How can you align an image inside of a containing div? Example In my example, I need to vertically center the

avatar
Corey
0 1 0 9
asked 07 September, 2021
51 votes
30 answers
2.7K views
Transitions on the CSS display property

I'm currently designing a CSS 'mega dropdown' menu - basically a regular CSS-only dropdown menu

avatar
Dorinda
0 1 0 9
asked 07 September, 2021
54 votes
22 answers
1.2K views
How do CSS triangles work?

There're plenty of different CSS shapes over at CSS Tricks - Shapes of CSS and I'm particularly puzz

avatar
Freida
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
1.3K views
How can I transition height: 0; to height: auto; using CSS?

I am trying to make a <ul> slide down using CSS transitions. The <ul> starts off at height: 0;. O

avatar
Yolando
0 1 0 9
asked 07 September, 2021
64 votes
30 answers
2K views
Is there a CSS parent selector?

How do I select the <li> element that is a direct parent of the anchor element? As an example, my CSS w

avatar
Clarice
0 1 0 9
asked 07 September, 2021
50 votes
30 answers
604 views
How to disable text selection highlighting

For anchors that act like buttons (for example Questions, Tags, Users, etc. which are located on the top of th

avatar
Corey
0 1 0 9
asked 07 September, 2021
62 votes
16 answers
1.6K views
How do I reformat HTML code using Sublime Text 2?

I've got some poorly-formatted HTML code that I'd like to reformat. Is there a command that will aut

avatar
Sena
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
823 views
How do I vertically align text in a div?

I am trying to find the most effective way to align text with a div. I have tried a few things and none seem t

avatar
Percy
0 1 0 9
asked 07 September, 2021
56 votes
30 answers
1.3K views
Hide scroll bar, but while still being able to scroll

I want to be able to scroll through the whole page, but without the scrollbar being shown. In Google Chrome i

avatar
Arline
0 1 0 9
asked 07 September, 2021
55 votes
12 answers
776 views
Why don&apos;t self-closing script elements work?

What is the reason browsers do not correctly recognize: <script src="foobar.js" /> <!-- self-closing

avatar
Xavier
0 1 0 9
asked 07 September, 2021
50 votes
24 answers
2.7K views
How do I style a <select> dropdown with only CSS?

Is there a CSS-only way to style a <select> dropdown? I need to style a <select> form as much as

avatar
Shanita
0 1 0 9
asked 07 September, 2021