Html 试着将我的div居中,这样当我切换监视器时,它们的大小保持不变
您好,我是html/css新手,我想知道如何将div居中,这样当我切换到不同的显示器时,它们将保持在同一位置 目前的问题是,当我切换时,会监控收割台的移动,这样它就不会与下方大div的边缘对齐。我想它,如果你切换显示器时,每一部分的所有伸展到新的显示器 我希望它的标题与div框对齐,无论它显示在哪个监视器上。因此,它在一个监视器上的显示方式就是它在另一个监视器上的显示方式 HTMLHtml 试着将我的div居中,这样当我切换监视器时,它们的大小保持不变,html,css,resize,position,monitor,Html,Css,Resize,Position,Monitor,您好,我是html/css新手,我想知道如何将div居中,这样当我切换到不同的显示器时,它们将保持在同一位置 目前的问题是,当我切换时,会监控收割台的移动,这样它就不会与下方大div的边缘对齐。我想它,如果你切换显示器时,每一部分的所有伸展到新的显示器 我希望它的标题与div框对齐,无论它显示在哪个监视器上。因此,它在一个监视器上的显示方式就是它在另一个监视器上的显示方式 HTML 您正在使用左边距:auto
您正在使用
左边距:auto在#中间部分上进行编码,因此它肯定会自动在中心对齐。
要获得所需内容,请固定
margin-left: 120px <---change value accordingly
左边距:120px
div{
border-style:solid;
border-width:1px;
border-color:white;
}
html{
height: 100%;
width: 100%;
margin-left: auto;
margin-right: auto;
}
body{
background-color: #252322;
}
.mainContainer{
margin-left:auto;
margin-right:auto;
width: auto;
height: 400px;
}
.header{
background-color: #252322;
font-family: arial, sans-serif;
height: 80px;
overflow: hidden;
padding-top: 19px;
}
#headerTopSection{
height: 80px;
width: auto: 0px;
}
#titleWordsWrapper{
width: 350px;
height: 50px;
float: left;
}
#titleHeaderTailored{
color: white;
font-size: 30px;
}
#titleHeaderSystems{
color: yellow;
display: inline-block;
font-size: 30px;
}
#productsAndInformationWrapper{
width: 350px;
height: 50px;
float: right;
}
#products{
float: right;
color: white;
font-size: 30px;
padding-right: 20px;
}
#contactUs{
float: right;
color: white;
font-size: 30px;
}
#midSection{
height: 200px;
width: 1000px;
background-color: #282625;
clear: left;
margin-left: auto;
margin-right: auto;
color: white;
}
margin-left: 120px <---change value accordingly