问题
I have created my website as a fixed layout, with a width of 1600px, but the webpage on a smaller resolution looks too big. What am I supposed to do to make it looks good in every resolution?
Thanks for help
回答1:
Use relative measures, like width: 100%
. You can constrain this even more by using min-width
and max-width
.
Apart from that, you can use CSS media queries to make styles that only apply if certain conditions are met, like a minimum or maximum width. If you use that, you can change the whole look and feel of your website, for instance by hiding parts on smaller devices or change from a 2 column to a 1 column text presentation on smaller devices.
回答2:
A percentage-based width would change the width depending on the screen size, but you should also use min-width
to ensure the page doesn't become too thin that it ruins your content.
回答3:
Your options:
- Use a narrower fixed width. Staying under 1,000 pixels is fairly safe though not perfect
- Use percentages for page width instead, though this is difficult if you need to have a set width for child elements to look right
- Do a combination of the above and use media queries in your CSS to make your site responsive. It'll fit every screen width you specify AND you'll have full control over your layout at each trigger point.
Here is a great resource for learning about responsive sites - this is the way to build a modern website, so though it might seem confusing it's worth every minute you spend on it.
http://bradfrost.github.com/this-is-responsive/resources.html
Good luck.
来源:https://stackoverflow.com/questions/13381137/i-need-to-get-my-website-to-fit-the-screen