简体   繁体   English

如何以%设置元素的宽度

[英]How to set width of an element in %

I need to know is how can I set the width of an element in % .Please provide some information about the ratio of setting width in percentage. 我需要知道如何以%设置元素的宽度。请提供一些有关以百分比设置宽度的比率的信息。

Suppose I have a following html 假设我有以下html

     <dl  >
         <dd >
         <dl>
        <dt >
    something
        </dt>
        <dd>
      something
        </dd>
        </dl>
        <dl>
        <dt  >

     something
        </dt>
        <dd >
     something
        </dd>
         </dl>
         <dl >             
        <dt >
    something
        </dt>
        <dd>
    something
        </dd>
        </dl>
        </dd>
       </dl> 

I need to know How can set the width of each element using %.Is der any relation for setting the height in the css? 我需要知道如何使用%来设置每个元素的宽度。在CSS中设置高度是否有任何关系? Thanks in advance 提前致谢

Setting a width via % works just the same as setting with pixels. 通过%设置宽度与使用像素设置一样。

width: 35%; 

instead of 代替

width: 250px;

There ARE ratios that people tend to use with wireframes that are pretty standard. 人们倾向于使用相当标准的线框。 YUI2 dealt quite a bit with this. YUI2处理了很多。

http://developer.yahoo.com/yui/grids/builder/ http://developer.yahoo.com/yui/grids/builder/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM