?指定TOP,BOTTOM,LEFT和RIGHT来设置大小 [英] ? Specifying TOP, BOTTOM, LEFT, and RIGHT to set size

查看:116
本文介绍了?指定TOP,BOTTOM,LEFT和RIGHT来设置大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




是否可以创建这样的彩色框? :


< html>

< head>

< style type =" text / css">

#bbb {

背景:#f00;

职位:绝对;

top:10px;

剩余:50px;

底部:100px;

右:300px

}

< / style>

< / head>


< body>

< div id =" bbb" ;>< / div>

< / body>

< / html>

我试了一下它在FireFox中有效和Opera(虽然盒子比较宽,但是在FireFox中比在Opera中略高一些)。但它在

IE中不起作用(我知道,我知道)。实际上在IE中,除非我在DIV中放入

的东西(例如< p> a< / p> - < p>< / p>不行)。即使是

然后,它只有我放入其中的元素一样高又宽。我已经看到

很多投诉并在IE中进行固定定位但我正在使用

绝对值。另外,我正在指定所有4个维度,并且我看到的唯一例子只有两个。


它只是IE或者我我做错了什么?如果它是IE,是否有一个

的解决方法?如果没有,我该如何解决?

谢谢。


-

-

Alec S.

alec< @> synetech<。> cjb<。> net

解决方案

Alec S.写道:


< snip>

它只是IE还是我做错了什么?


它只是IE。它不能根据两个相对边缘的

定位来设置元素的大小。

如果它是IE,是否有解决方法?




也许是JavaScript。


-

David Dorward< http:// blog .dorward.me.uk /> < http://dorward.me.uk/>

Home是〜/ .bashrc的地方


* Alec S. * skrev 2004-09-25 01:17:



是否可以创建这样的彩色框? :

< html>
< head>
< style type =" text / css">
#bbb {
背景:#f00;
位置:绝对;
顶部:10px;
左:50px;
底部:100px;
右:300px
}
< / style>
< / head>

< body>
< div id =" bbb">< / div>
< / body>
< / html>

我尝试了它,它适用于FireFox和Opera(尽管盒子比较宽,而且FireFox比它高一点)在歌剧院)。但它在IE浏览器中不起作用(我知道,我知道)。实际上在IE中,除非我在DIV中添加了某些内容(例如< p> a< / p> - < p>< / p>不起作用),否则它不会显示在所有内容中。即便如此,它只有我放入其中的元素一样高又宽。我已经看到了很多抱怨并在IE中进行固定定位但我正在使用绝对的
。此外,我正在指定所有4个维度,我看到的唯一示例仅使用了两个。

是IE还是我做错了什么?如果它是IE,是否有解决方法?如果没有,我该如何解决?




你必须在IE显示之前设置宽度和高度值。


-

/ Arne


但明确设置宽度和高度会覆盖宽度和
通过设置左+右和顶部+底部引起的
高度。

-

Alec S.

alec< @ > synetech<。> cjb<。> net

" Arne" < AR ** @ luras.nu>在消息中写道

新闻:WJ ********************* @ newsc.telia.net ...


你必须在IE显示之前设置宽度和高度值。

-
/ Arne



Hi,

Is it possible to create a colored box like this? :

<html>
<head>
<style type="text/css">
#bbb {
background: #f00;
position: absolute;
top: 10px;
left: 50px;
bottom: 100px;
right: 300px
}
</style>
</head>

<body>
<div id="bbb"></div>
</body>
</html>
I tried it and it works in FireFox and Opera (although the box is wider
and slightly taller in FireFox than in Opera). However it does not work in
IE (I know, I know). In fact in IE it does not show up AT ALL unless I put
something in the DIV (for example a <p>a</p> - <p></p> does not work). Even
then, it is only as tall and wide as the element I put in it. I''ve seen
lots of complaints and work around for fixed positioning in IE but I''m using
absolute. Also, I''m specifying all 4 dimensions and the only examples I''ve
seen have used just two.

Is it just IE or am I doing something wrong? If it''s IE, is there a
workaround? If not, how can I fix it?
Thanks.

--
--
Alec S.
alec <@> synetech <.> cjb <.> net

解决方案

Alec S. wrote:

<snip>

Is it just IE or am I doing something wrong?
Its just IE. It can''t cope with setting the size of an element based on the
positioning of two opposite edges.
If it''s IE, is there a workaround?



JavaScript perhaps.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


*Alec S.* skrev 2004-09-25 01:17:

Hi,

Is it possible to create a colored box like this? :

<html>
<head>
<style type="text/css">
#bbb {
background: #f00;
position: absolute;
top: 10px;
left: 50px;
bottom: 100px;
right: 300px
}
</style>
</head>

<body>
<div id="bbb"></div>
</body>
</html>
I tried it and it works in FireFox and Opera (although the box is wider
and slightly taller in FireFox than in Opera). However it does not work in
IE (I know, I know). In fact in IE it does not show up AT ALL unless I put
something in the DIV (for example a <p>a</p> - <p></p> does not work). Even
then, it is only as tall and wide as the element I put in it. I''ve seen
lots of complaints and work around for fixed positioning in IE but I''m using
absolute. Also, I''m specifying all 4 dimensions and the only examples I''ve
seen have used just two.

Is it just IE or am I doing something wrong? If it''s IE, is there a
workaround? If not, how can I fix it?



You must set a width and hight value to the box before IE can show it.

--
/Arne


But setting the width and height explicitly overrides the width and
height caused by setting the left+right and top+bottom.
--
Alec S.
alec <@> synetech <.> cjb <.> net
"Arne" <ar**@luras.nu> wrote in message
news:WJ*********************@newsc.telia.net...


You must set a width and hight value to the box before IE can show it.

--
/Arne



这篇关于?指定TOP,BOTTOM,LEFT和RIGHT来设置大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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