如何在“em”中显示一个框单位? [英] How to display a box in "em" units?

查看:64
本文介绍了如何在“em”中显示一个框单位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图找出如何显示宽度为
" em"单位。到目前为止没有运气。下面是一些HTML,它以小写和大写显示两行$ 30 $ b行的30英寸字符,然后是

a 30em宽表和一个30em宽的div块。我正在使用HTML 4.01

Transitional doctype。


==================== ============

< p>行30 M:< br>

MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM< br>

mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm< br>

< table width =" 30em" border = 1 cellspacing = 0 cellpadding = 0>

< tr>< td> 30em宽表< / td>< / tr>

< / table> ;

< div style =" border:1px solid black;宽度= 30em;最小宽度= 30em; float:left;">

30em宽矩形

< / div>

========== ======================


结果表格显示为30像素而不是30em。这是非常狭窄的



div块只与包含文本一样宽。这是

肯定不是30 M字符宽。


我做错了什么?上面的示例在IE中也是如此,并且

Opera。

此外,em使用了哪个M宽度。单位?大写或

小写?对于较大的字体大小,这些宽度是不同的。


-A

解决方案

ax ** @ spamcop.net (axlq)写道:

我正在使用HTML 4.01 Transitional doctype。


为什么不严格?

< table width =" 30em" border = 1 cellspacing = 0 cellpadding = 0>


< table style =" width:30em" border = 1 ...

此外,em使用哪个M宽度。单位?大写或
小写?对于较大的字体大小,这些宽度是不同的。




两者都不是 - 它是em quad的宽度。


-

克里斯


文章< 87 ************ @ dinopsis.dur .ac.uk>,

Chris Morris< c。******** @ durham.ac.uk>写道:

ax ** @ spamcop.net(axlq)写道:

我正在使用HTML 4.01 Transitional doctype。



为什么不严格?




这有关系吗? em的行为是否是em的行为。单位之间的变化

过渡和严格?


-A


axlq写道:

我正在使用HTML 4.01 Transitional doctype。



为什么不严格?



重要吗? em的行为是否是em的行为。单位在过渡和严格之间变化?



是的。

编号


过渡期,如你可能会从这个术语中猜测,这意味着允许从v4之前的HTML逐渐过渡到v4。名字中隐含的是

过渡,暂时,一会儿,短时间,占位符,一个

喘息的空间。它从来没有打算用于普通的持续使用。

Strict的一个更有说服力的理由是浏览器渲染更加统一且可预测,特别是IE。


-

jmm(连字符)列表(at)sohnen-moe(点)com

(删除电子邮件的.AXSPAMGN)


I''m trying to figure out how to display a box that has a width in
"em" units. So far no luck. Below is some HTML that displays two
rows of 30 ''m'' characters in lowercase and uppercase, followed by
a 30em-wide table and a 30em-wide div block. I''m using HTML 4.01
Transitional doctype.

================================
<p>lines of 30 M:<br>
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<br>
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm<br>
<table width="30em" border=1 cellspacing=0 cellpadding=0>
<tr><td>30em wide table</td></tr>
</table>
<div style="border: 1px solid black; width=30em; min-width=30em; float: left;">
30em wide rectangle
</div>
================================

The resulting table appears to be 30 pixels instead of 30em. It''s
very narrow.

The div block is only as wide as the containing text. It''s
certainly not 30 M characters wide.

What am I doing wrong? The example above works the same in IE and
Opera.

Also, which M width is used by the "em" units? Uppercase or
lowercase? These widths are different for larger font sizes.

-A

解决方案

ax**@spamcop.net (axlq) writes:

I''m using HTML 4.01 Transitional doctype.
Why not strict?
<table width="30em" border=1 cellspacing=0 cellpadding=0>
<table style="width: 30em" border=1 ...
Also, which M width is used by the "em" units? Uppercase or
lowercase? These widths are different for larger font sizes.



Neither - it''s the width of the "em quad".

--
Chris


In article <87************@dinopsis.dur.ac.uk>,
Chris Morris <c.********@durham.ac.uk> wrote:

ax**@spamcop.net (axlq) writes:

I''m using HTML 4.01 Transitional doctype.



Why not strict?



Does it matter? Does the behavior of "em" units change between
transitional and strict?

-A


axlq wrote:

I''m using HTML 4.01 Transitional doctype.



Why not strict?



Does it matter? Does the behavior of "em" units change between
transitional and strict?


Yes.
No.

Transitional, as you might surmise from the term, was meant to allow a
gradual transition from pre-v4 HTML to v4. Implied in the name is
transition, temporary, for a little while, short time, placeholder, a
breather space. It was never intended for common, ongoing usage.
A more cogent reason for Strict is that browser rendering is more
uniform and predictable, especially IE.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


这篇关于如何在“em”中显示一个框单位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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