Sven
Sven

Reputation: 13295

Responsive Web Design - using px values

When creating a responsive website, I use percentage values for most width and height declarations.
How about padding and margin - is it ok to use px values there or should I also use percentages?

That both works is pretty clear, I am just concerned that some strange behavior of mobile phones (auto zoom or whatever, I don't know) messes something up.

Upvotes: 0

Views: 200

Answers (2)

Chris Visser
Chris Visser

Reputation: 1647

You can however prevent alot problems by working according to W3C standards. Most browsers follow them and will prevent strange behaviour. Also try using mediaqueries in CS. They allow you to create different margins for smaller or different devices

Upvotes: 0

egrunin
egrunin

Reputation: 25053

px is almost never the best answer. If by "percentages" you mean .5em, yes, that's usually best.

But device manufacturers have taken to lying to the browser about everything, so nothing will replace testing on the actual devices. As usual.

(Example: the iPad Mini has a physically smaller screen than the iPad, so you want to use bigger type; but there's no way for your code to detect that it's a Mini. Sigh.)

Upvotes: 2

Related Questions