div内容显示问题?

来源:百度知道 编辑:UC知道 时间:2024/05/19 11:28:08
请问怎样控制div块内容在客户端的显示位置,既在屏幕上的显示位置。
如:div块w内有内容111,编辑端111处于W块的左上方,用浏览器浏览时要111显示于W块的右下方或居右且向下两格显示等。请高手帮忙!谢谢
呵呵,朋友还是没有明白我的意思。
我的前提是不可以用margin、border、padding、text-align等命令来设置编辑端的显示位置,既固定编辑端的位置再来设置客户端(屏幕)的位置。
如下面这段代码我要111显示在222的下面,但<bood>标签内的内容不可以做任何改动。
代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>div块内容显示位置设置</title>
<style type="text/css">
#w{
width:200px;
height:200px;
text-align:left;
background-color:#CCCCCC;
}
</style>
</head>

<body>
<div id="w">
<div>111</div>
<div>222</div>
</div>
</body>
</html>
不一定要用CSS控制哦

帮你写了一下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>div块内容显示位置设置</title>
<style type="text/css">
#w{
position:relative;
width:200px;
height:200px;
text-align:left;
background-color:#CC0000;
}
.x1,.x2{position:absolute; bottom:5px;background-color:#ff00CC;}
.x1{right:40px;}
.x2{right:5px;}
</style>
</head>

<body>
<div id="w">
<div class="x1">111</div>
<div class="x2">222</div>
</div>
</body>
</html>

有一个东西,我改写了下,查看下效果,你会喜欢的。

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>块内容互换</title>

&