首页 > 解决方案 > 网格溢出到下面的 div

问题描述

我正在创建一个个人网站来展示我的其他工作,并认为它想自己从头开始构建网站以学习一项技能。我已经完成了一个“作品集部分”,该部分display: grid用于创建多个图块,每个图块代表我从事的一个项目。它工作得很好,完全符合我的要求。我现在正在创建一个联系人部分,但投资组合区域与我创建的新联系人 div 重叠,并且不确定原因。任何帮助表示赞赏。

问题照片(穿过作品集图块的线条应显示联系并放置在作品集下方。我将联系最小高度设置为 800 像素,并且仅显示 150-200,因为它也从作品集部分的开头开始。现场视觉

我也有设置为隐藏的模态容器,直到单击最终联系代码下方的按钮,但这似乎不是问题,所以我没有发布。

代码:

// ----------------------Portfolio Tile Styles----------------------//

.portfolio{
  width: 100%;
  background-color: rgb(245,245,245); 
}

//Styles for the portfolio buttons
.btn-container{
  margin-top:50px;
  background-color: rgb(245,245,245); 
  text-align: center;
  

}

//Styles to set all portfolio tiles to be initally hidden;
  .photogrammetry, .cv, .dev{
    display: none;
  }
  

.filter-btn{
  padding: 5px 20px;
  margin:10px 5px;
  border: 2px solid #e31b6d;
  color: #e31b6d;
  cursor: pointer;
  letter-spacing: 1px;
  background-color: white;
  text-transform: uppercase;
  transition:transform .3s;
  transition: color .3s;
  transition: background-color .3s;
}

.filter-btn:hover{
  color:white;
  background-color: #e31b6d;
}

.gallery-wrapper{
  position: absolute;
  width:100%;
  display: flex;
  background-color: rgb(245,245,245); 
}

// Portfolio Gallery Styles
.gallery{
  position: relative;
  width: 100%;
  padding: 0 7%;
  overflow: hidden;
  margin: 0% 5% 2% 5%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));

}

/* The "show" class is added to the filtered elements */
.show {
  display: block;
}

.card{
  overflow: hidden;  
  align-items: center;
  width: auto;
  height: 250px;
  margin: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  background-size: cover;



}


.top-text{
  text-align: center;
  transform:translateY(-100px);
  transition:transform .3s;
}

.card-btn,{
  width:50%;
  padding: 5px;
  text-transform: uppercase;;
  letter-spacing: 1px;
  background: transparent;
  color: #e31b6d;
  opacity: 1;
  border: 2px solid #e31b6d;
  outline: none;
  cursor: pointer;
  transform:translateY(100px);
  transition:transform .3s;
  transition: color .3s;
  transition: background-color .3s;
}



.card:hover{
   .card-btn{
    transform: translateY(0px);
  }

  .top-text{
  transform:translateY(0px);
  }
}

.card-btn:hover{
    color:white;
    background-color: #e31b6d;
  }

//Tile Backgrounds
.AutoFP {
    background: url("../images/portfolioTile/AFP_Tile.png") center no-repeat; 
    background-size: cover;
  }
.fpl-1 {
    background: url(https://media.defense.gov/2013/Jul/16/2000032379/-1/-1/0/130628-F-DQ639-002.JPG) center no-repeat; 
    background-size: cover;
  }

.fpl-2 {
    background: url("../images/portfolioTile/IS_Tile.jpg") center no-repeat; 
    background-size: cover;

  }

.fpl-3 {
  background: url("../images/portfolioTile/Algae_Tile.png") center no-repeat;  
  background-size: cover;
}
.fpl-4 {
  background: url("../images/portfolioTile/AFP_Tile.jpg") center no-repeat;  
  background-size: cover;

}
.fpl-5 {
  background: url("../images/portfolioTile/UCW_Tile.png") center no-repeat;  
  background-size: cover;
}
.fpl-6 {

  background: url("../images/portfolioTile/Portrait_Tile.png") center no-repeat;  
  background-size: 100%;
  background-color: white;
}
.fpl-7 {
  background: url("../images/portfolioTile/CamCal_Tile.png") center no-repeat;  
  background-size: contain;
  background-color: white;
}

//Faded Tile Background
.AutoFP:hover{
    background: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.7)),url("../images/portfolioTile/AFP_Tile.png") center no-repeat;
    background-size: cover;
}
.fpl-1:hover {
  background: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.7)),url(https://media.defense.gov/2013/Jul/16/2000032379/-1/-1/0/130628-F-DQ639-002.JPG) center no-repeat; 
  background-size: cover;
}

.fpl-2:hover {
  background: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.7)),url("../images/portfolioTile/IS_Tile.jpg") center no-repeat; 
  background-size: cover;
}

.fpl-3:hover {
  background: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.7)),url("../images/portfolioTile/Algae_Tile.png") center no-repeat;  
  background-size: cover;
} 
.fpl-4:hover {
  background: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.7)),url("../images/portfolioTile/AFP_Tile.jpg") center no-repeat;  
  background-size: cover;
}
.fpl-5:hover {
  background: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.7)),url("../images/portfolioTile/UCW_Tile.png") center no-repeat;  
  background-size: cover;
}
.fpl-6:hover {

  background: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.7)),url("../images/portfolioTile/Portrait_Tile.png") center no-repeat;  
  background-size: 100%;
  background-color: rgba(255,255,255,0.7);
}
.fpl-7:hover {
  background: linear-gradient(rgba(255,255,255,0.7), rgba(255,255,255,0.7)),url("../images/portfolioTile/CamCal_Tile.png") center no-repeat;  
  background-size: contain;
  background-color: rgba(255,255,255,0.7);
}
<!---------------------- Portfolio Gallery ---------------------->
	<!-- Where the tiles will go shocasing work -->
	<div class="portfolio" id="portfolio">
		<h1>Projects</h1>
		<div class = "btn-container">
			<button class="btn active filter-btn" onclick="filterSelection('all')">All</button>
			<button class="btn filter-btn" onclick="filterSelection('photogrammetry')">Photogrammetry</button>
			<button class="btn filter-btn" onclick="filterSelection('cv')">Computer Vision</button>
			<button class="btn filter-btn" onclick="filterSelection('dev')">Developer</button>

		</div>

		<div class = "gallery-wrapper">
			
			<div class = "gallery">
				<!-- Tile 1 -->
				<div class = "photogrammetry dev filterDiv">
					<div class = "AutoFP card ">
						<div class ="top-text">
							<h3 class = "card-heading">Automated FlightPlanning</h3>
							<span>Electron, Python</span>
						</div>
						<button class="card-btn" id ="AutoFP">Learn More</button>
					</div>
				</div>
				<!-- Tile 2 -->
				<div class = "dev cv filterDiv">
					<div class = "fpl-1 card ">
						<div class ="top-text">
							<h3 class = "card-heading">Change Detection</h3>
							<span>OpenCV, Python</span>
						</div>
						<button class="card-btn" id ="cd">Learn More</button>
					</div>
				</div>
				<!-- Tile 3 -->
				<div class = "dev cv filterDiv">
					<div class = "fpl-2 card ">
						<div class ="top-text">
							<h3 class = "card-heading">Image Stitching</h3>
							<span>C++, OpenCV</span>
						</div>
						<button class="card-btn" id ="imgStitch">Learn More</button>
					</div>
				</div>
				<!-- Tile 4 -->
				<div class = "dev cv filterDiv">
					<div class = "fpl-3 card " >
						<div class ="top-text">
							<h3 class = "card-heading">Algae Detection</h3>
							<span>OpenCV, Python</span>
						</div>
						<button class="card-btn" id ="AlgDec">Learn More</button>
					</div>
				</div>
				<!-- Tile 5 -->
				<div class = "photogrammetry filterDiv">
					<div class = "fpl-4 card ">
						<div class ="top-text">
							<h3 class = "card-heading">Aerial 3D Model</h3>
							<span>DJIFlightPlanner, MetaShape  </span>
						</div>
						<button class="card-btn" id ="A3DM">Learn More</button>
					</div>
				</div>
				<!-- Tile 6 -->
				<div class = "dev filterDiv">
					<div class = "fpl-5 card ">
						<div class ="top-text">
							<h3 class = "card-heading">University Course Website</h3>
							<span>HTML, CSS</span>
						</div>
						<button class="card-btn" id ="UCW">Learn More</button>
					</div>
				</div>
				<!-- Tile 7 -->
				<div class = "photogrammetry filterDiv">
					<div class = "fpl-6 card ">
						<div class ="top-text">
							<h3 class = "card-heading">University Course Website</h3>
							<span>Research Paper</span>
						</div>
						<button class="card-btn" id ="RP">Learn More</button>
					</div>
				</div>
				<!-- Tile 8 -->
				<div class = "photogrammetry filterDiv">
					<div class = "fpl-7 card ">
						<div class ="top-text">
							<h3 class = "card-heading">Camera Calibration of "Prosumer" drones</h3>
							<span>Journal Article</span>
						</div>
						<button class="card-btn" id ="JA">Learn More</button>
					</div>
				</div>
	   		</div>
		</div>
	</div>
	

	<!---------------------- Contact Page ---------------------->
	<div>
		<div class = contact-wrapper>
			<h1>CONTACT</h1>
		</div>
	</div>

标签: htmlcsscss-grid

解决方案


推荐阅读