I need to get my website to fit the screen

心已入冬 提交于 2019-12-02 07:30:28

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!