Html 我已经创建了具有绝对定位的divjava脚本…但是

Html 我已经创建了具有绝对定位的divjava脚本…但是,html,Html,所有计算机的边距都是不同的,所以图像并没有放在它们应该放的地方 <div id="mydiv" style="height: 25px;width: 503px; left: 659px; position: absolute; text-align: center; top: 805px; width: 130px;width:328px;background:black" onmouseover="this.style.background='yellow';" onmouseout=

所有计算机的边距都是不同的,所以图像并没有放在它们应该放的地方

<div id="mydiv" style="height: 25px;width: 503px; left: 659px; position: absolute; text-align: center; top: 805px; width: 130px;width:328px;background:black" onmouseover="this.style.background='yellow';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 20px;width: 503px; left: 659px; position: absolute; text-align: center; top: 785px; width: 130px;width:328px;background:black" onmouseover="this.style.background='violet';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 20px;width: 503px; left: 659px; position: absolute; text-align: center; top: 765px; width: 130px;width:328px;background:black" onmouseover="this.style.background='indigo';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 20px;width: 503px; left: 659px; position: absolute; text-align: center; top: 745px; width: 130px;width:328px;background:black" onmouseover="this.style.background='red';" onmouseout="this.style.background='white';">

    </div>

<div id="mydiv" style="height: 20px;width: 503px; left: 659px; position: absolute; text-align: center; top: 576px; width: 130px;width:328px;background:black" onmouseover="this.style.background='green';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 20px;width: 503px; left: 659px; position: absolute; text-align: center; top: 556px; width: 130px;width:328px;background:black" onmouseover="this.style.background='orange';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 20px;width: 503px; left: 659px; position: absolute; text-align: center; top: 536px; width: 130px;width:328px;background:black" onmouseover="this.style.background='brown';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 20px;width: 503px; left: 659px; position: absolute; text-align: center; top: 519px; width: 130px;width:328px;background:black" onmouseover="this.style.background='violet';" onmouseout="this.style.background='white';">

    </div>

<div id="mydiv" style="height: 150px;width: 40px; left: 659px; position: absolute; text-align: center; top: 596px; width: 10px;width:25px;background:black" onmouseover="this.style.background='indigo';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 150px;width: 40px; left: 659px; position: absolute; text-align: center; top: 596px; width: 10px;width:25px;background:black" onmouseover="this.style.background='brown';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 150px;width: 40px; left: 684px; position: absolute; text-align: center; top: 596px; width: 10px;width:25px;background:black" onmouseover="this.style.background='green';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 150px;width: 40px; left: 709px; position: absolute; text-align: center; top: 596px; width: 10px;width:25px;background:black" onmouseover="this.style.background='pink';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 150px;width: 40px; left: 734px; position: absolute; text-align: center; top: 596px; width: 10px;width:25px;background:black" onmouseover="this.style.background='violet';" onmouseout="this.style.background='white';">

    </div>

<div id="mydiv" style="height: 150px;width: 40px; left: 885px; position: absolute; text-align: center; top: 596px; width: 10px;width:25px;background:black" onmouseover="this.style.background='indigo';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 150px;width: 40px; left: 905px; position: absolute; text-align: center; top: 596px; width: 10px;width:25px;background:black" onmouseover="this.style.background='green';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 150px;width: 40px; left: 930px; position: absolute; text-align: center; top: 596px; width: 10px;width:25px;background:black" onmouseover="this.style.background='blue';" onmouseout="this.style.background='white';">

    </div>
<div id="mydiv" style="height: 150px;width: 40px; left: 955px; position: absolute; text-align: center; top: 596px; width: 10px;width:32px;background:black" onmouseover="this.style.background='red';" onmouseout="this.style.background='white';">

    </div>

  • 图像?在您的示例中只有div元素

  • 不能为所有元素提供相同的id,id必须是唯一的(HTML4.01和XHTML)

除此之外,您发布的示例在Firefox3.6、Chrome和InternetExplorer8中给出了一个“方形甜甜圈”形状


由于您使用了position:absolute,我不确定计算机边距会如何影响此布局。你是指屏幕大小/浏览器大小-如果我在1024x768窗口中查看此示例,形状几乎脱离页面,我必须滚动,但它仍然存在。也许你可以更详细地描述这个问题?

请发布一些代码或其他东西,我们不是通灵者。你有什么问题。详细地告诉他们。也许另一个可以解决这里的语法问题。