Tom
Tom

Reputation: 11

Media Query for text-align: center

I'm having some issues with a media query. I'm trying to center text for mobile devices only. I've added the following to my CSS, but it doesn't seem to be doing the trick. Any help would be much appreciated. Thanks!

@media only screen and (max-width:500px){.category-compare {text-align:center;}}

Upvotes: 1

Views: 8750

Answers (2)

A.K.
A.K.

Reputation: 2322

Please replace text-align:center; to text-align:center !important;. This is forcefully text-align property.

Upvotes: 0

Mark Eriksson
Mark Eriksson

Reputation: 1475

Make sure your nesting is correct. Media queries are very pedantic.

Check your code for previous text-align rules on .category-compare and check how it is nested, i.e.: .main-content .left-side .category-compare. If it is nested like that, you will need to do the same nesting for your media query.

Upvotes: 0

Related Questions