此代码具有1.左侧的text区域2.右边的div两者挨着。
问题:#cxt-machine1在屏幕大小发生变化时移动/更改或不保持原位,同时margin-left:600px;
也发生变化。
#cxt{position:relative; margin:auto; width:70%; height:300px; border:#CCCCCC 1px solid; background-color:#EEEEEE; margin-bottom:50px;}
<div id="cxt">
<span>
<div style="position:relative; left:20px; width:50%; height:10px; margin-bottom:10px;">
<span id="B1" class="styling">B1</span>
<span id="I1" class="styling">I1</span>
<span id="U1" class="styling">U1</span>
<span id="I2" class="styling">I2</span>
<span id="I3" class="styling">I3 Link</span>
<span id="B2" class="styling">B2</span>
<span id="S1" class="styling">S1</span>
</div>
<div id="PCxt">
<form method="post" action="">
<textarea cols="75" rows="10" id="Tmat" name="Tmat" style=" position:relative; left:0px"></textarea>
<br>
<input type="submit" value="Submit" id="Submit">
</form>
</div>
</span>
<span>
<div> style="position:relative; width:48%; height:150px; left:448px; top:-258px; max-width:48%; max-height:5px; text-align:center; font-family:arial; font-size:14px; font-weight:bold;">Cxt-machine Preview</div>
<div id="cxt-machine-1" style="position:fixed; width:30%; height:250px; margin-left:600px; top:445px; max-width:30%; max-height:250px; overflow: auto; background-color:#ffffff; border:#CCCCCC solid 1px;"></div>
</span>
</div>
寻找将#cxt-machine1
固定在与窗口大小无关的位置的解决方案。
对不起。。。将所有内容转换为表,尽管我想获得无表编码,但时间不多了,感谢您的帮助
给div,#cxt
一个以像素为单位的宽度,您应该会得到您想要的结果。
此外,根据百分比或像素为文本区域指定宽度,不要依赖cols
属性来获得所需的样式。