gpt4 book ai didi

html - 响应画廊行为怪异

转载 作者:太空宇宙 更新时间:2023-11-04 09:36:58 27 4
gpt4 key购买 nike

我正在尝试创建一个具有充分响应性和吸引力的图片库。但是,当图像无法像图库中的一组正常图像那样对齐时,这是非常困难的,当您缩小窗口/图库时,图像看起来很棒。但是在窗口全屏的情况下,图像开始显得怪异,而且顺序不对。如果有人知道到底出了什么问题或要添加什么,请告诉我。谢谢!

div.img {
border: 1px solid #ccc;
}

div.img:hover {
border: 1px solid #777;
}

div.img img {
width: 100%;
height: auto;
}

div.desc {
padding: 15px;
text-align: center;
}

* {
box-sizing: border-box;
}

.responsive {
padding: 0 6px;
float: left;
width: 24.99999%;
}

@media only screen and (max-width: 700px){
.responsive {
width: 49.99999%;
margin: 6px 0;
}
}

@media only screen and (max-width: 500px){
.responsive {
width: 100%;
}
}

.clearfix:after {
content: "";
display: table;
clear: both;
}


body {
background-color: white;
margin: 0;
padding: 0;

}

.navigation {
padding-top: 70px;
padding-bottom: 70px;
position: relative;
text-transform: uppercase;
overflow: hidden;
}

.brand-text {
font-family: 'Permanent Marker', cursive;
font-size: 50px;
color: black;
-webkit-transition: color 1000ms ease;
text-align: center;
margin-bottom: 20px;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding: 0;
display: block;
display:inline-block;
position: relative;
text-align: center;
left: 50%;
transform: translate(-50%);
}


.brand-text:hover {
color: grey;

}

.nav-brand {
text-decoration:none;
}

.nav-menu {
text-align: center;
}

.nav-link {
padding-top: 7px;
padding-bottom: 7px;
margin-right: 20px;
margin-left: 20px;
text-decoration: none;
text-align: center;
color: grey;
font-family: 'Raleway', sans-serif;
-webkit-transition: color 700ms ease;
position: relative;
display: inline-block;
}

.nav-link:hover {
color: black;
}

.current {
color: black;
}

.current:hover {
color:
}

.about-section {
width: 75%;
margin: auto;
border: 3px solid #f2f2f2;
position: relative;
}

.me-image {
width: 100%;

}

.about-img {
width: 100%;
height: auto;
position: relative;
float: left;
overflow: hidden;
margin-bottom: 20px;
}

.about-title {
color: black;
font-family: 'Raleway', sans-serif;
font-size: 40px;
margin: 20px;

}

.about-me {
font-family: 'Libre Franklin', sans-serif;
line-height: 150%;
margin: 20px;
font-size: 18px;
}

.footer {
background-color: #f2f2f2;
padding: 20px;
margin-top: 30px;
font-family: 'Libre Franklin', sans-serif;
position: relative;
bottom: 0;
clear: both;
left: 0;
right: 0;
bottom: 0;
}
<!DOCTYPE html>
<html>
<head>
<title>Josh Corbett</title>
<meta charset="UTF-8">
<meta name="description" content="Portfolio of Josh Corbett. Full of photography, art, graphics/illustrations, and maybe more!" />
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<link rel="stylesheet" type="text/css" href="images.css">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Permanent+Marker" rel="stylesheet">
</head>
<body>
<div class="navigation">
<a class="nav-brand" href="#"><h1 class="brand-text">Josh Corbett</h1></a>
<div class="container">
<nav class="nav-menu" role="navigation">
<a class="nav-link current" href="Home.html">Portfolio</a>
<a class="nav-link" href="About.html">About</a>
<a class="nav-link" href="Blog.html">Blog</a>
</nav>
</div>
</div>

<div class="responsive">
<div class="img">
<a target="_blank" href="#">
<img src="Photos/apple.png" alt="Apple Vector" width="600" height="400">
</a>
<div class="desc">Apple Products Vector</div>
</div>
</div>

<div class="responsive">
<div class="img">
<a target="_blank" href="#">
<img src="Photos/Panda.jpg" alt="Cute Panda" width="600" height="400">
</a>
<div class="desc">Cute Panda</div>
</div>
</div>
<div class="responsive">
<div class="img">
<a target="_blank" href="#">
<img src="Photos/2dlandscape.jpg" alt="Flat Landscape" width="600" height="400">
</a>
<div class="desc">Flat Landscape</div>
</div>
</div>
<div class="responsive">
<div class="img">
<a target="_blank" href="#">
<img src="Photos/jclogo.png" alt="JC Logo" width="600" height="400">
</a>
<div class="desc">JC Logo</div>
</div>
</div>
<div class="responsive">
<div class="img">
<a target="_blank" href="#">
<img src="Photos/Leaf.JPG" alt="Leaf" width="600" height="400">
</a>
<div class="desc">Raspberry Leaf</div>
</div>
</div>
<div class="responsive">
<div class="img">
<a target="_blank" href="#">
<img src="Photos/Grass.JPG" alt="Grass" width="600" height="400">
</a>
<div class="desc">Long Grass</div>
</div>
</div>
<div class="responsive">
<div class="img">
<a target="_blank" href="#">
<img src="Photos/Me.jpg" alt="Me" width="600" height="400">
</a>
<div class="desc">Just Me</div>
</div>
</div>

<div class="footer">
©Josh Corbett 2016
</div>
</body>
</html>

最佳答案

这是较长的文本描述,当它环绕时您会看到“怪异”。

添加空白:nowrap; .responsive 将解决您的问题。

我建议尝试使用 flexbox 之类的技术,因为您将更少地与浏览器打交道。 http://www.sketchingwithcss.com/samplechapter/cheatsheet.html

关于html - 响应画廊行为怪异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40251342/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com