在屏幕中间显示div [英] display the div in middle of the screen
问题描述
我有gridview.在此gridview中包含值.假设我单击一个链接按钮,则显示一个通过div标签使用的弹出窗口.我的问题是假设如果我向下滚动gridview,并且如果我单击链接按钮,则div在顶部打开.但我想显示屏幕的中心.
Hi,
I have gridview. In this gridview contain value. Suppose if i click one link buttion i am showing one popup using by div tag. My problem is suppose if i scroll down the gridview and if i click link button the div is opening at top. But i want show center of the screen. how to do?
推荐答案
使用位置固定样式的标签
use position to fixed tag of style
style="position:fixed; top:100px; left:100px;"
你好朋友,
您可以通过这种方式进行:
Hello Friend,
You can do in this way :
<div id="dvUpdate" style="left: 44%; float: none;
top: 27%; position: fixed;">
在%age中使用左侧和顶部位置.然后这将适用于所有分辨率.与以像素为单位进行比较.
希望对您有帮助.
如果有帮助,别忘了将其标记为答案. :)
use left and top position in %age. then this''ll work for every resolution. as compare to set in pixels.
Hope this will help you.
And Don''t forget to mark as answer if it helps. :)
使用div的绝对定位.
Hi,
Use absolute positioning of div.
<div id="mydiv" position: absolute; top: 10px; left: 3px; width: 240px; height: 150px; </div>
这将计算屏幕的顶部,左侧位置.因此,div始终显示在同一位置.
希望这会有所帮助.
This will calculate the top, left position from the screen.Therefore, the div will always be displayed at the same position.
Hope this helps.
这篇关于在屏幕中间显示div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!