如何使z-index适合页面而不调用
How to make a z-index fit to page and not scalling
如何使z-index适合页面,而不是调用我需要把它从svg,但我的svg是适合页面。
这里是div代码
<div id="homeScreen" class="grey_box" style="background-color:#CDCDCD;
position: absolute;
left: 0px;
top: 8px;
width: 373px;
height: 537px;
visibility: visible;">
<p class="hello" >E-Number<input id="tags" /></p>
<p class="hello2">Mat-Number<input id="tags1" /><p>
<p class="hello3">Tech. ID<input type="text" name="fname"><p>
<p class="hello4">RIS<input type="text" name="fname"><p>
<p class="hello5"> <button onclick="get_action_home()" style="width: 100px">Continue</button><p>
<p class="hello6">Βάση δεδομένων: Τοπικός</p>
<p class="hello7">Σύνδεση: κομμένη</p>
<p class="hello8">Κατάσταση βάσης δεδ.: Μη επίκαιρη</p>
</div>
这里是javascript动态地放置它
function adjust()
{
var DMMScreen = document.getElementById("DMM");
//new screens dinamic
var homeScreen = document.getElementById("homeScreen");
homeScreen.style.height = DMMScreen.getBoundingClientRect().height;
homeScreen.style.width = DMMScreen.getBoundingClientRect().width;
homeScreen.style.top = DMMScreen.getBoundingClientRect().top;
homeScreen.style.left = DMMScreen.getBoundingClientRect().left;
//
这是我从jquery中发现的但是我不知道如何修复它
$(window).resize(function() {
$("#width").text($(this).width());
$("#height").text($(this).height());
});
,这里是它的功能链接[链接](https://www.dropbox.com/s/ebsha1t091ewk40/good2.png)和这是我换窗户时的坏情况[链接](https://www.dropbox.com/s/b7n4nn3gg2gb6fn/good.png)
z-index
不适合任何东西,它是一个"分层"工具,允许您将元素放在彼此的顶部,我认为您的意思是您有position:fixed
或position:absolute
与z-index
结合…如果是这种情况,你可以使用width:100%;
<style>
.full_width {
top:0;
left:0;
z-index:1;
height:20%;
width:100%;
position:fixed;
text-align:center;
}
</style>
</head>
<body>
<div class="full_width"> i will fit the width of the page</div>
your other stuff here...
</body>
如果这不是你的意思,那么请提供更多的信息。
编辑您提供的链接,您不需要使用position
或z-index
,
将margin-left
和margin-right
设置为auto
并将容器定义为width
..
粘贴HTML &我们可以给你更多的帮助
但是就目前而言,在页面中间放置这个框的一个例子是
<style>
.grey_box {
width:500px;
height:600px;
margin-left:auto;
margin-right:auto;
background-color:#CCC;
}
</style>
<div class="grey_box">
<!-- your content here-->
</div>
示例:http://jsfiddle.net/AbQsa/
相关文章:
- 如何使jQuery插件函数可调用以供独立使用,而不在集合上操作
- 如何在chrome扩展中存储数据/结果,以及如何使用setTimeout使其只被调用一次
- 任何方式使AJAX调用Gmail API,而无需通过JS库
- 如何放置单独的ajax调用,使页面的一部分完全响应,而另一部分仍在加载
- 使变量可用于不带闭包的异步调用
- 如何进行AJAX调用,使其仅在我单击包含在特定类中的链接时触发;id”;父元素的
- 如何使应用程序加载独立于web服务调用
- node.js,async,restify:无法使restify调用在async.series内同步
- 当draggable使嵌套可排序时调用Drop
- 当与全局标志一起使用时,Javascript Regex在后续调用中返回null
- 如何使许多jQuery ajax调用看起来很漂亮
- React如何调用ES6类的呈现函数,使“this”不引用类本身
- 如何在php echo中添加代码,使其在调用时成为弹出窗口
- 使Javascript调用同步
- 如何使对象可以作为实例和函数调用
- 如何在AngularJS中从RT API调用中使电影总标题不重复
- 更改对JSON对象的调用以使程序更加抽象
- 抽象AJAX调用,使代码更加动态
- 如何包装函数调用,有时做异步调用,使其行为同步
- 将this.constructor与构造函数调用一起使用以访问静态属性时是否存在兼容性问题