0

这是一个笼统的问题。我正在使用必须响应的 Bootstrap 构建一个网站。我想知道在 LESS/css 上工作的“标准”程序是什么。

首先,您为标准站点(用于桌面显示)创建 css 规则?responsive-767px-max.less其次,您是否在适当的 LESS 文件(等)中添加了智能手机或平板电脑的特定规则?

问题是桌面和智能手机显示必须有许多规则然后我应该在每个responsive-xxx.less文件中复制这些规则。我认为这不是太舒服。也许公共规则必须写在bootstrap.less@import 规则下面?

简而言之,我很想知道您是如何管理这些事情的。

4

1 回答 1

1

In theory, Responsive is more bottom-up than what you describe.

  1. First, you make sure your site/app works in the most barebones browser, with minimal support of CSS and JS.
  2. Then you build up from there, adding "icing" with greater browser capabilities and window size.

It also about not just using the breakpoints, but also making some things scale sensible in size, width, height, as the window is resized.

In practice, just by using Bootstrap, you're gaining the above capabilities. You shouldn't have to do too much more other than make some decisions in the media queries for certain components to show or hide, like you describe.

  • Include the responsive stylesheet
  • Use the fluid versions of containers and rows, like:

Here's the relevant Bootstrap docs:

于 2013-03-25T23:00:42.280 回答