如何在放大和缩小时停止失真?

问题描述 投票:0回答:1

我正在研究CSS,但在放大和缩小时遇到一些问题。我设置了最大宽度,高度并仍面临一些挑战。这是我的CSS。

你能告诉我这里做错了什么吗?我想这样做,如果用户放大和缩小,CSS将不会改变我的布局。现在不同的浏览器正在改变CSS。

body {
    position: relative;
    overflow-x: hidden;
    min-width:300px;
    zoom: 0.8;
    -moz-transform: scale(0.8);
    -webkit-transform: scale(0.8);
    transform: scale(0.8);    
}
body,
html {
    height: 100rem;
    background-color: #583e7e;
}      
.chatboxPos {
    position: fixed;
    bottom: 11%;
    left: 40%;
}
.allMsgs {
    height: 580px;
    overflow: auto;
    width: 80%;
    display: inline-block;
 }
 .oneMsg {
     position: relative;
     width: 100%;
     z-index: 10000;
     //overflow: auto;
 }
.msgImg {
    z-index: -1;
    //z-index: 0;
    position: absolute;
    //top: inherit;
}
.sentMsg {
    position: absolute;
    left: 20%;
    top: 5%;
    width: 475px;
    height: 150px;
    //display: block;
    overflow-y: scroll;
    text-align: left;
    color: #ffffff;
}
.msgSender {
    font-size: 1.3em;
    position: inherit;
    right: 1%;
}
.msgContent {
    font-size: 1.1em;
    position: inherit;
    left: 30%;
    text-align: left;
}
.adjustImg {
    width: 570px;
}
#style-2::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
    border-radius: 10px;
    background-color: #F5F5F5;
}

#style-2::-webkit-scrollbar {
    width: 30px;
    background-color: #F5F5F5;
}

#style-2::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
    background-color: #D62929;
}
.whosHere table tr td img {
    height: 50rem;
    width: 35rem;
    position: relative;
    right: 35rem;
}
html css
1个回答
0
投票

您应该使用媒体查询...如果您可以请转到引导程序...媒体查询很容易,而且学习曲线较少

© www.soinside.com 2019 - 2024. All rights reserved.