Javascript 如何居中<;img>;哪个有z索引?
我无法将图像居中,此时,它会停留在左侧。这个概念是当我点击图像时,图像的大版本会弹出给我们 HTML: Javascript: 将Javascript 如何居中<;img>;哪个有z索引?,javascript,html,css,image,Javascript,Html,Css,Image,我无法将图像居中,此时,它会停留在左侧。这个概念是当我点击图像时,图像的大版本会弹出给我们 HTML: Javascript: 将#大尺寸面板100%宽度和中心对齐内容 .photoposition{ width: 250px; height: 250px; margin-left: 53px; float: left; position: relative; } .scaledownlandscape{ width: 250px; ob
#大尺寸面板
100%宽度和中心对齐内容
.photoposition{
width: 250px;
height: 250px;
margin-left: 53px;
float: left;
position: relative;
}
.scaledownlandscape{
width: 250px;
object-fit: scale-down;
display: block;
margin: 0 auto;
}
.divspan{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 1;
}
#largeImgPanel {
visibility: hidden;
position: fixed;
z-index: 100;
top: 0;
left: 0;
width: 500px;
height: 400px;
background-color: rgba(100,100,100, 0.5);
margin-top: 141px;
}
能否请您将问题复制成一把小提琴左右..尝试将
right:0
添加到#largeImgPanel
right:0
无效您能否将代码显示在小提琴上..如何添加小提琴@拉尔
.photoposition{
width: 250px;
height: 250px;
margin-left: 53px;
float: left;
position: relative;
}
.scaledownlandscape{
width: 250px;
object-fit: scale-down;
display: block;
margin: 0 auto;
}
.divspan{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 1;
}
#largeImgPanel {
visibility: hidden;
position: fixed;
z-index: 100;
top: 0;
left: 0;
width: 500px;
height: 400px;
background-color: rgba(100,100,100, 0.5);
margin-top: 141px;
}
function showImage(imgName) {
document.getElementById('largeImg').src = imgName;
showLargeImagePanel();
unselectAll();
}
function showLargeImagePanel() {
document.getElementById('largeImgPanel').style.visibility = 'visible';
}
function unselectAll() {
if(document.selection) document.selection.empty();
if(window.getSelection) window.getSelection().removeAllRanges();
}
function hideMe(obj) {
obj.style.visibility = 'hidden';
}
#largeImgPanel {
visibility: hidden;
position: fixed;
z-index: 100;
top: 0;
left: 0;
right: 0;
width: 500px;
height: 400px;
background-color: rgba(100,100,100, 0.5);
margin-top: 141px;
text-align: center;
}