开发者

how to set position of <div> tag [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

I have set the position of tag using following line

<div id="myTestDiv" style="border: 2px solid rgb(100, 149, 237); color:#23238e; background-color:white; position:absolute; top:458px; left:605px; width:210px; height:162px; display:none" >

the problem with this is, its working fine in my machine, but when i deploy the code on some other machine, the position and style (background color) are not开发者_如何转开发 displayed properly...

do any one have any idea, how to set uniform style and position of div for all resolution

Thanks in advance


Looking at your code, I can't see why it doesn't work the same way on all machines.

  1. Since you are hard coding the numbers for top and left, where you see it on the monitor(position) depends on the size of the monitor. On your's it might appear exactly at the center but on a bigger/smaller screen, it won't. It just appears exactly at 458px from top and 605px from left. Try using % values.

  2. The color difference may be due to the hardware ie. the condition ans settings of the monitor.


You can work with percent values. Avoid rgb(xxx, xxx, xxx) syntax. And always check yout html from old to modern browsers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜