我已经尝试了几个小时让以下代码正常工作,但是一直没有成功... 您能帮我把项目div居中吗(即使页面缩放)?
这是我的HTML和CSS:
#bottom {
position: absolute;
top: 100%;
left: 0;
right: 0;
background-color: #FFF;}
#secondsection {
background-size: 100% auto;
background-size: cover;
color: #eaeaf0;
margin-left: 7%;
margin-right: 7%;
padding-top: 35px;
padding-bottom: 35px;
position: relative;}
#ss_top {
width: 100%;
height: 100%;}
.ss_title {
display: inline;
float:left;
color: #000000;
font-family: 'Eurostile';
font-size: 35px;
text-transform: uppercase;}
.ss_title2 {
color: #a5a5a5;}
#gallerybutton {
position: relative;
display: inline;
float: right;
margin-right: 0%;
margin-top: 50px;
padding: 20px;
background-color: #000;
text-decoration: none;
border: none;
color: #FFF;
text-transform: uppercase;}
#projects {
position: relative;
margin-left: auto;
margin-right: auto;
max-width: 2000px;
padding: 175px 0px 0px 0px;}
#pr_one, #pr_two {
display: block;}
.pr_img {
float: left;
display: inline;
margin-right: 1%;
margin-bottom: 1%;}
#viewprofilebutton {
position: relative;
left: -75px;
margin-left: 50%;
margin-top: 3.5%;
margin-bottom: 2.5%;
padding: 20px;
background-color: #000;
text-decoration: none;
border: none;
color: #FFF;
text-transform: uppercase;}
<div id="secondsection">
<div id="ss_top">
<p class="ss_title">A selection of projects<br /><span class="ss_title2">I've worked on lately</span></p>
<button type="button" id="gallerybutton">See everything</button>
</div>
<div id="projects">
<div id="pr_one">
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
</div>
<div id="pr_two">
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
<div class="pr_img"><a target="_blank" href=""><img src="images/pr_nfs.jpg" alt="" width="488px" height="272px"></a></div>
</div>
</div>
<a href="#thirdsection"><button type="button" id="viewprofilebutton">See my work</button></a>
</div>