网页版式:像素与百分比 [英] Web Layouts: pixels vs percentages

查看:270
本文介绍了网页版式:像素与百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网络布局中为像素和百分比定义距离的用例是什么?

What are the use cases for defining distances in a web layout for pixels and percentages?

就多种分辨率而言,使用像素是否有不利之处?他们会正确缩放吗?

Is there any downside to using pixels with respect to multiple resolutions? Will they scale correctly?

推荐答案

百分比布局

这通常称为流体布局.您的元素将占可用空间的确定百分比.此可用空间由元素的父级决定.

Percentage layout

This is generally referred to as fluid layout. Your elements will take a defined percentage of the total space available to them. This available space is determined by the element's parent.

使用百分比布局时,最好指定最小宽度并在您的设计上最大宽度,以使其在非常低的温度下仍可使用高分辨率.

When using percentage layouts, it's a good idea to specify a min-width and max-width on your design so that it remains usable at very low and high resolutions.

专业人士

  1. 按屏幕尺寸缩放,因此,如果可用的话,要使用更多的空间.

缺点

  1. 使知道某物在屏幕上的确切位置更加困难.结果,它会使创建精确的布局更加困难.
  2. 如果子元素的宽度固定(即图像)并且最终大于其流体宽度父元素,则可能导致意外的布局.

像素布局

这通常称为固定布局.您的元素将始终具有相同的定义像素大小,并且不会考虑可用的父空间.

Pixel layout

This is usually known as fixed layout. Your element will always be the same defined pixel size and will not take available parent space into account.

专业人士

  1. 始终知道元素的确切大小.
  2. 创建精确的布局更加容易.

缺点

  1. 您无法根据分辨率进行缩放.您的布局将始终具有相同的宽度,从而在人们获得高分辨率时浪费了空间.

这篇关于网页版式:像素与百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆