【发布时间】:2021-08-01 11:10:12
【问题描述】:
我更改了现在适用于所有浏览器的“关于我们”部分的格式。但是,我尝试将 flexboxes 安装到移动设备上,但只有偶数行没有正确对齐。奇数行与图像对齐,然后是文本。偶数行仍然与文本并排。我尝试将 flex-direction 更改为 column,但它不起作用。我错过了什么?
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css>
<link href=https://fonts.googleapis.com/css?family=Montserrat:400,500,700,900|Ubuntu:400,500,700 rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@media only screen and (min-device-width: 320px) and (max-device-width: 480px){ /*Desktop*/
.container {
padding: 2px;
height: auto;
width: auto;
flex-direction: column;
}
.container:nth-of-type(even) {
flex-direction: column;
padding: 2px;
height: auto;
width: auto;
}
img {
width: 80%;
}
}
@media only screen and (min-device-width: 320px) and (max-device-width: 480px){ /*Desktop*/
h1 {
text-align: center;
width: 100%;
height: 100%;
display: inline-block;
}
h4 {
text-align: left;
width: 100%;
height: 100%;
display: inline-block;
}
}
.container {
display: flex;
align-items: center;
justify-content: center;
padding: 25px;
}
.container:nth-of-type(even) {
flex-direction: row-reverse;
align-items: center;
justify-content: center;
}
img {
max-width: 100%;
}
h1 {
font-family: 'Montserrat', sans-serif;
font-weight: 300;
font-size: 26px;
color: #5e5c5c;
text-align: center;
}
h4 {
font-family: 'Montserrat', sans-serif;
font-weight: 300;
font-size: 18px;
color: #5e5c5c;
line-height: 1.25;
}
li {
margin: 10px;
}
</style>
</head>
<body>
<!-----#Michael----->
<div class="container">
<img src=https://i.postimg.cc/9QsRxd2q/Michael.png alt="Michael"/ width="25%" height="25%">
<ul>
<h1><b>Michael Schlaefer, CEO</b></h1>
<h4><li>Owner of Global Development Contractors, LLC; Plymouth Industries, LLC; Liberty Stone & Aggregates - Clinton Quarry, LLC; Vision Development Group, LLC; and Green Earth Container Service, LLC.</li>
<li>Over 40 years of experience in site work; demolition; remediation; trucking material management, facility operations, complex brownfield and landfill redevelopment projects.</li>
<li>Board member – Tewksbury Environmental Commission</li></h4>
</ul>
</div>
<!-----#Jen----->
<div class='container'>
<img src=https://i.postimg.cc/nhX9YdyJ/Jen.png alt="Jen"/ width="25%" height="25%">
<ul>
<h1><b>Jennifer D. Kraft, COO</b></h1>
<h4><li>In-house counsel for Global Development Contractors, LLC with extensive experience with material management, operations, site development and compliance with environment regulations.</li>
<li>Chair – Tewksbury Board of Health</li>
<li>Member – Professional Women in Construction (PWC)</li></h4>
</ul>
</div>
【问题讨论】:
标签: html css mobile flexbox alignment