使用 flexbox 的响应式投资组合/联系人
Posted
技术标签:
【中文标题】使用 flexbox 的响应式投资组合/联系人【英文标题】:Responsive portfolio/contacts with flexbox 【发布时间】:2021-02-10 19:26:03 【问题描述】:我正在从头开始构建一个单页投资组合和联系人网站,该网站在移动版本中看起来不错。 我正在努力让它在平板电脑和桌面版本中看起来像预期的那样。
目前,移动版有一个投资组合部分,下方有缩略图和文本(在移动视图中,它只会显示 2 个项目,但在平板电脑和台式机上应该是 8 个),一个在另一个下方.包含照片、一些介绍性文字、表单和社交图标的联系人部分。
我仍在处理平板电脑视图。
我最大的问题是:
平板电脑视图
作品集:虽然 8 个项目成功显示在 2 列/4 行上,但它们在左侧略微对齐。如果我设法使缩略图居中对齐,则文本/说明也居中对齐,但它应该像当前一样显示在左侧。
联系人:联系人中的图片和介绍文字也出现类似问题:略微向左对齐。虽然平板视图应该保持移动视图,即顶部的图像和介绍,中间的表格,底部的社交图标,但在平板电脑上,尤其是表格太宽,这就是为什么我设置宽度,但我不确定这是否是正确的方法。
所有拇指都有一个类,因为我希望它们根据设备调整大小。 但是我担心我通过尝试不同的方法和解决方案在中间的某个地方弄乱了代码。
编辑 10/29/20:我实际上是通过更改一些代码块来修复投资组合部分,例如从图像中删除“thumb”类。
我现在最大的问题如下:
平板电脑视图:
联系人部分仍然一团糟:目的仍然是像在移动视图中那样在另一个 div 下显示一个 div,但它太宽、对齐错误,并且社交图标出现在不应该出现的地方。
底部有一些空间,版权正下方。
桌面视图:
以前徽标和导航显示在同一行,但现在不再是这样了,导航显示在右侧但略低于。
联系人部分在这里也搞砸了:3 个 div 彼此相邻显示,而它们应该在左侧显示 2 个 div 和 1 个 div(更大/更长,即带有表格)在右边。
就像在平板电脑视图中一样,底部有一些空间,版权正下方。
这是当前代码:
/* General Style */
html,
body
margin: 0;
padding: 0;
box-sizing: border-box;
html
font-size: 16px;
body
font: 400 1em 'Roboto', Arial, sans-serif;
color: #BFBFBF;
background: #262526;
padding: 0;
margin: 0 auto;
.container
width: 90%;
margin: 0 auto;
padding: 0;
h1,
h2,
h3
font-family: 'Playfair Display', serif;
margin: 0;
padding: 0;
h4,
h5,
h6
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
ul,
ol
list-style-type: none;
margin: 0;
padding: 0;
a
font-weight: bold;
color: #ED8E82;
text-decoration: none;
a:hover,
a:active
color: #BFBFBF;
img
width: 100%;
.topsection
background: #262526;
display: flex;
justify-content: center;
align-items: center;
flex-flow: row wrap;
.middlesection
background: #4A484A;
.bottomsection
background: #F2F2F2;
/* Base Header - Footer Style */
header
display: flex;
justify-content: center;
align-items: center;
flex-flow: row wrap;
margin: 0 auto;
text-align: center;
flex-basis: 100%;
header .logo a
font: 400 normal 1.25em 'Playfair Display', serif;
color: #BFBFBF;
text-transform: uppercase;
line-height: 2.109375em;
height: 50px;
margin: 0;
footer
margin: 0 auto;
width: 100%;
footer p
margin: 0;
.copyright
font-size: 0.875em;
color: #BFBFBF;
text-align: center;
margin: 20px 0;
/* ---- MOBILE STYLE --- */
/* Navigation*/
header nav
padding: 40px 0;
display: flex;
justify-content: center;
align-items: center;
flex-basis: 100%;
header nav ul
margin: 0;
padding: 0;
header nav ul li
padding: 10px 0;
line-height: 2.109375em;
header nav ul li a
font: 400 normal 1em 'Roboto', sans-serif;
color: #BFBFBF;
text-transform: uppercase;
text-decoration: none;
text-align: center;
position: relative;
padding-bottom: 5px;
header nav ul li a:hover,
header nav ul li a:active
color: #ED8E82;
p
font-size: 1em;
line-height: 1.25em;
/* About */
.about-me
margin-bottom: 130px;
.about-me h3
font-weight: bold;
font-size: 1.875em;
color: #ED8E82;
line-height: 1em;
padding: 25px 0;
.about-me span
color: #BFBFBF;
.about-me p
font-size: 1.25em;
/* Portfolio */
.portfolio
display: flex;
flex-wrap: wrap;
justify-content: center;
#portfolio
padding: 65px 0 80px;
#portfolio h3
font-weight: bold;
font-size: 1.875em;
font-style: italic;
color: #ED8E82;
line-height: 1.25em;
margin-bottom: 65px;
width: 100%;
text-align: center;
.work
display: flex;
padding: 0.5em;
width: 100%;
.portfolio h6
font-size: 1em;
font-style: italic;
line-height: 1.0625em;
color: #F2F2F2;
margin-top: 0;
margin-bottom: 0.4em;
.seemore-link
text-align: center;
margin-top: 30px;
.mobileHide
display: none;
/* Contacts */
.contacts
display: flex;
flex-wrap: wrap;
#contacts
padding: 65px 0 80px;
#contacts h3
font-weight: bold;
font-size: 1.875em;
font-style: italic;
color: #ED8E82;
line-height: 1.25em;
margin-bottom: 65px;
width: 100%;
text-align: center;
.pic-cv
display: flex;
padding: 0.5em;
width: 100%;
.pic-cv img
margin-bottom: 18px;
.piccv-text span
color: #ED8E82;
.piccv-text p
text-align: left;
color: #262526;
.form
text-align: left;
color: #262526;
max-width: 25em;
margin-bottom: 18px;
.form h6
font-weight: bold;
font-size: 1em;
color: #ED8E82;
line-height: 1.1875em;
text-align: center;
margin: 77px 0 25px;
.contacts input[type=email]
box-sizing: border-box;
width: 100%;
background: #fff;
border: 1px solid #BFBFBF;
padding: 1em;
color: #BFBFBF;
margin-bottom: 12px;
.contacts textarea
box-sizing: border-box;
width: 100%;
overflow: hidden;
background: #fff;
border: 1px solid #BFBFBF;
padding: 1em;
color: #BFBFBF;
margin-bottom: 12px;
.contacts input[type=submit]
width: 100%;
padding: 20px 0;
margin-top: 20px;
background-color: #ED8E82;
font: 600 normal 1.125em 'Roboto', sans-serif;
color: #F2F2F2;
border: none;
text-align: center;
text-transform: uppercase;
.required:after
content:" *";
color: #ED8E82;
.pic-cv h6
font-weight: bold;
font-size: 1em;
color: #ED8E82;
line-height: 1.1875em;
width: 100%;
text-align: center;
margin: 77px 0 25px;
.social-icons
display: flex;
justify-content: space-around;
align-items: center;
.social-icons p a
display: flex;
justify-content: center;
align-items: center;
background: #BFBFBF;
color: #F2F2F2;
width: 40px;
height: 40px;
border-radius: 50%;
margin: 24px;
.social-icons p i
font-size: 1.3125em;
/* End Mobile Style */
/* Tablet Style */ /* 48em = 768px */
@media (min-width: 48em)
.mobileHide
display: block;
/* About */
.about-me
margin-top: 50px;
margin-bottom: 172px;
.about-me h3
width: 100%;
font-size: 2.25em;
/* Portfolio */
.work
flex: 0 1 47%;
.seemore-link
visibility: hidden;
/* Contacts */
.contacts
/*max-width: 38em;*/
.pic-cv
justify-content: center;
align-items: center;
flex-flow: row wrap;
max-width: 25em;
/* Desktop Style */ /* 75em = 1200px */
@media (min-width: 75em)
/* Navigation */
header
margin: 0 auto;
header .logo
text-align: left;
flex-basis: 44%;
header nav
flex-basis: 44%;
justify-content: flex-end;
header nav ul li
padding: 0 10px;
display: inline;
header nav ul li a:hover,
header nav ul li a:active
color: #BFBFBF;
header nav ul li a::before
content: "";
position: absolute;
width: 100%;
height: 3px;
bottom: 0;
left: 0;
background-color: #ED8E82;
visibility: hidden;
transform: scaleX(0);
transition: all 0.3s ease-in-out 0s;
header nav ul li a:hover::before
visibility: visible;
transform: scaleX(1);
/* About */
.about-me
margin-top: 250px;
margin-bottom: 250px;
.about-me p
width: 100%;
/* Portfolio */
.portfolio img
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on android */
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray; /* IE 6-9 */
img:hover
-webkit-filter: none;
-moz-filter: none;
-ms-filter: none;
filter: none;
.work
width: 33.33%;
.work-text
display: flex;
flex-direction: column;
padding: 1em;
width: 100%;
.work-text p
flex: 1 0 auto;
/* Contacts */
.pic-cv
width: 30%;
.piccv-text
display: flex;
flex-direction: column;
padding: 1em;
width: 100%;
.piccv-text p
flex: 1 0 auto;
<body>
<!-- Header / Navigation -->
<header class="topsection">
<div class="container">
<div class="logo"><a href="">Logo name</a></div>
<nav>
<ul>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contacts">Contacts</a></li>
</ul>
</nav>
</div><!-- Container ends here -->
</header> <!-- Header / Navigation ends here -->
<div class="topsection">
<section class="about-me container" data-aos="fade-up" id="about">
<h3>Hello, this is <span>some text.</span> <br>I love text.</h3>
<p>Some more text.</p>
<p>And a lot of text.</p>
</section>
</div><!-- About ends here -->
<div class="middlesection">
<section id="portfolio" data-aos="fade-down" class="container">
<h3>portfolio</h3>
<ul class="portfolio">
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
</ul>
<!-- End hidden content -->
<div class="seemore-link"><!-- Hidden only on tablet/desktop view-->
<a href="portfolio.html">See more</a>
</div>
</section>
</div>
<footer class="bottomsection">
<section id="contacts" class="container" data-aos="fade-right" >
<h3>contacts</h3>
<div class="contacts">
<div class="pic-cv">
<div class="piccv-text">
<img src="img/pic.jpg" />
<p>Have any question? Please get in touch.<br><span>Email:</span> thisemail@gmail.com</p>
</div>
</div>
<div id="form" class="form">
<h6>Ask Info</h6>
<form method="post" action="http://web-domain.com/cgi-bin/formmail.cgi" onsubmit="return checkform(this);">
<label class="required" for="email">Email:</label>
<input type="email" required="required" value="email address">
<label class="required" for="text">Message:</label>
<!--<input type="text" "required" value="message">-->
<textarea name="text" cols="48" rows="5" required="required">message</textarea>
<input type="submit" value="send"></form>
<!--Form ends here-->
</div>
<div class="pic-cv">
<div id="socials" class="piccv-text">
<h6>Social</h6>
<div class="social-icons">
<p><a href="link.com" target="_blank"><i class="icon"></i></a></p>
<p><a href="link.com" target="_blank"><i class="icon"></i></a></p>
</div>
</div>
</div>
</div>
</section><!-- Contacts ends here -->
<p class="copyright"> Copyright © Name and Last Name</p>
</footer>
</body>
非常感谢您提供的任何帮助。
【问题讨论】:
谢谢@cornonthecob。我实际上设法通过更改几块代码来修复投资组合部分,但联系人部分仍然搞砸了(平板电脑视图太宽,第一个和第三个 div 没有居中对齐,应该在桌面上的 2 列上),并且桌面视图中的徽标和导航也不再对齐。这是完整的测试代码:codepen.io/Penelope79/pen/wvWyPBO 嗨@Pen061 我已经编辑了我的帖子,希望这是你需要的:) 感谢您为 @corn 所做的所有努力,我也刚刚更新了我的问题,因为同时我修复了投资组合部分。 :) 请你看看我的编辑...花了我 57 分钟,享受 :) 另外,请我们在我的回答下继续这个讨论,因为如果我们这样做我会收到通知,而且它通常更方便:) 【参考方案1】:这段代码应该会有所帮助:
平板电脑:
-
我添加了更多的弹性框来对齐中间的东西
我已从页脚版权中删除了边距并用填充替换它
桌面:
Flexbox 不适用于儿童,所以我将它应用到他们身上
您应该为此使用网格,请参阅代码 :)
/* General Style */
html,
body
margin: 0;
padding: 0;
box-sizing: border-box;
html
font-size: 16px;
body
font: 400 1em 'Roboto', Arial, sans-serif;
color: #BFBFBF;
background: #262526;
padding: 0;
margin: 0 auto;
.container
width: 90%;
margin: 0 auto;
padding: 0;
h1,
h2,
h3
font-family: 'Playfair Display', serif;
margin: 0;
padding: 0;
h4,
h5,
h6
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
ul,
ol
list-style-type: none;
margin: 0;
padding: 0;
a
font-weight: bold;
color: #ED8E82;
text-decoration: none;
a:hover,
a:active
color: #BFBFBF;
img
width: 100%;
.topsection
background: #262526;
.topsection > .container
display: flex;
justify-content: center;
align-items: center;
flex-flow: row wrap;
.middlesection
background: #4A484A;
.bottomsection
background: #F2F2F2;
/* Base Header - Footer Style */
header
display: flex;
justify-content: center;
align-items: center;
flex-flow: row wrap;
margin: 0 auto;
text-align: center;
flex-basis: 100%;
header .logo a
font: 400 normal 1.25em 'Playfair Display', serif;
color: #BFBFBF;
text-transform: uppercase;
line-height: 2.109375em;
height: 50px;
margin: 50px 0 0 0;
footer
margin: 0 auto;
width: 100%;
footer p
margin: 0;
.copyright
font-size: 0.875em;
color: #BFBFBF;
text-align: center;
margin: 0;
padding: 20px 0;
/* ---- MOBILE STYLE --- */
/* Navigation*/
header nav
padding: 40px 0;
display: flex;
justify-content: center;
align-items: center;
flex-basis: 100%;
header nav ul
margin: 0;
padding: 0;
header nav ul li
padding: 10px 0;
line-height: 2.109375em;
header nav ul li a
font: 400 normal 1em 'Roboto', sans-serif;
color: #BFBFBF;
text-transform: uppercase;
text-decoration: none;
text-align: center;
position: relative;
padding-bottom: 5px;
header nav ul li a:hover,
header nav ul li a:active
color: #ED8E82;
p
font-size: 1em;
line-height: 1.25em;
/* About */
.about-me
margin-bottom: 130px;
.about-me h3
font-weight: bold;
font-size: 1.875em;
color: #ED8E82;
line-height: 1em;
padding: 25px 0;
.about-me span
color: #BFBFBF;
.about-me p
font-size: 1.25em;
/* Portfolio */
.portfolio
display: flex;
flex-wrap: wrap;
justify-content: center;
#portfolio
padding: 65px 0 80px;
#portfolio h3
font-weight: bold;
font-size: 1.875em;
font-style: italic;
color: #ED8E82;
line-height: 1.25em;
margin-bottom: 65px;
width: 100%;
text-align: center;
.work
display: flex;
padding: 0.5em;
width: 100%;
.portfolio h6
font-size: 1em;
font-style: italic;
line-height: 1.0625em;
color: #F2F2F2;
margin-top: 0;
margin-bottom: 0.4em;
.seemore-link
text-align: center;
margin-top: 30px;
.mobileHide
display: none;
/* Contacts */
.contacts
display: flex;
flex-wrap: wrap;
display: block; /* will be redifined as grid later on */
#contacts
padding: 65px 0 80px;
#contacts h3
font-weight: bold;
font-size: 1.875em;
font-style: italic;
color: #ED8E82;
line-height: 1.25em;
margin-bottom: 65px;
width: 100%;
text-align: center;
.pic-cv
grid-column: 1;
grid-row: 1;
display: flex;
padding: 0.5em;
width: 100%;
.socials-outer
grid-column: 1;
grid-row: 2;
.pic-cv img
margin-bottom: 18px;
.piccv-text span
color: #ED8E82;
.piccv-text p
text-align: left;
color: #262526;
.form
grid-column: 2;
grid-row: 1 / 3;
text-align: left;
color: #262526;
margin: 0 auto;
.form h6
font-weight: bold;
font-size: 1em;
color: #ED8E82;
line-height: 1.1875em;
text-align: center;
margin: 77px 0 25px;
.contacts input[type=email]
box-sizing: border-box;
width: 100%;
background: #fff;
border: 1px solid #BFBFBF;
padding: 1em;
color: #BFBFBF;
margin-bottom: 12px;
.contacts textarea
box-sizing: border-box;
width: 100%;
overflow: hidden;
background: #fff;
border: 1px solid #BFBFBF;
padding: 1em;
color: #BFBFBF;
margin-bottom: 12px;
.contacts input[type=submit]
width: 100%;
padding: 20px 0;
margin-top: 20px;
background-color: #ED8E82;
font: 600 normal 1.125em 'Roboto', sans-serif;
color: #F2F2F2;
border: none;
text-align: center;
text-transform: uppercase;
.required:after
content: " *";
color: #ED8E82;
.pic-cv
display: flex;
justify-content: center;
.pic-cv h6
font-weight: bold;
font-size: 1em;
color: #ED8E82;
line-height: 1.1875em;
width: 100%;
text-align: center;
margin: 77px 0 25px;
.social-icons
grid-template-columns: 1;
grid-template-rows: 2;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto;
.social-icons p a
display: flex;
justify-content: center;
align-items: center;
background: #BFBFBF;
color: #F2F2F2;
width: 40px;
height: 40px;
border-radius: 50%;
margin: 24px;
.social-icons p i
font-size: 1.3125em;
.copyright
margin: 0;
/* End Mobile Style */
/* Tablet Style */
/* 48em = 768px */
@media (min-width: 48em)
.mobileHide
display: block;
/* About */
.about-me
margin-top: 50px;
margin-bottom: 172px;
.about-me h3
width: 100%;
font-size: 2.25em;
/* Portfolio */
.work
flex: 0 1 47%;
.seemore-link
visibility: hidden;
/* Contacts */
.contacts
/*max-width: 38em;*/
width: 100%;
flex-direction: column;
justify-content: center;
.pic-cv
justify-content: center;
align-items: center;
flex-flow: row wrap;
/* Desktop Style */
/* 75em = 1200px */
@media (min-width: 75em)
/* Navigation */
header
margin: 0 auto;
header .logo
text-align: left;
flex-basis: 44%;
header nav
flex-basis: 44%;
justify-content: flex-end;
header nav ul li
padding: 0 10px;
display: inline;
header nav ul li a:hover,
header nav ul li a:active
color: #BFBFBF;
header nav ul li a::before
content: "";
position: absolute;
width: 100%;
height: 3px;
bottom: 0;
left: 0;
background-color: #ED8E82;
visibility: hidden;
transform: scaleX(0);
transition: all 0.3s ease-in-out 0s;
header nav ul li a:hover::before
visibility: visible;
transform: scaleX(1);
/* About */
.about-me
margin-top: 250px;
margin-bottom: 250px;
.about-me p
width: 100%;
/* Portfolio */
.portfolio img
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
/* Firefox 10+, Firefox on Android */
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray;
/* IE 6-9 */
img:hover
-webkit-filter: none;
-moz-filter: none;
-ms-filter: none;
filter: none;
.work
width: 33.33%;
.work-text
display: flex;
flex-direction: column;
padding: 1em;
width: 100%;
.work-text p
flex: 1 0 auto;
/* Contacts */
.contacts
display: grid;
.pic-cv
width: 30%;
.piccv-text
display: flex;
flex-direction: column;
padding: 1em;
width: 100%;
.piccv-text p
flex: 1 0 auto;
.form
margin: 0;
<body>
<!-- Header / Navigation -->
<header class="topsection">
<div class="container">
<div class="logo"><a href="">Logo name</a></div>
<nav>
<ul>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#contacts">Contacts</a></li>
</ul>
</nav>
</div>
<!-- Container ends here -->
</header>
<!-- Header / Navigation ends here -->
<div class="topsection">
<section class="about-me container" data-aos="fade-up" id="about">
<h3>Hello, this is <span>some text.</span> <br>I love text.</h3>
<p>Some more text.</p>
<p>And a lot of text.</p>
</section>
</div>
<!-- About ends here -->
<div class="middlesection">
<section id="portfolio" data-aos="fade-down" class="container">
<h3>portfolio</h3>
<ul class="portfolio">
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
<li class="work">
<div class="work-text">
<h6>Project</h6>
<img src="image" />
<p>Description</p>
<a href="" target="_blank">Link</a>
</div>
</li>
</ul>
<!-- End hidden content -->
<div class="seemore-link">
<!-- Hidden only on tablet/desktop view-->
<a href="portfolio.html">See more</a>
</div>
</section>
</div>
<footer class="bottomsection">
<section id="contacts" class="container" data-aos="fade-right">
<h3>contacts</h3>
<div class="contacts">
<div class="pic-cv">
<div class="piccv-text">
<img src="img/pic.jpg" />
<p>Have any question? Please get in touch.<br><span>Email:</span> thisemail@gmail.com</p>
</div>
</div>
<div id="form" class="form">
<h6>Ask Info</h6>
<form method="post" action="http://web-domain.com/cgi-bin/formmail.cgi" onsubmit="return checkform(this);">
<label class="required" for="email">Email:</label>
<input type="email" required="required" value="email address">
<label class="required" for="text">Message:</label>
<!--<input type="text" "required" value="message">-->
<textarea name="text" cols="48" rows="5" required="required">message</textarea>
<input type="submit" value="send"></form>
<!--Form ends here-->
</div>
<div class="pic-cv socials-outer">
<div id="socials" class="piccv-text">
<h6>Social</h6>
<div class="social-icons">
<p><a href="link.com" target="_blank"><i class="icon"></i></a></p>
<p><a href="link.com" target="_blank"><i class="icon"></i></a></p>
</div>
</div>
</div>
</div>
</section>
<!-- Contacts ends here -->
<p class="copyright"> Copyright © Name and Last Name</p>
</footer>
</body>
【讨论】:
请告诉我这是否有助于回答您的问题,@Pen061 这是一项了不起的工作@corn 棒极了!现在好多了!我还没有开始使用网格,这就是为什么我试图只使用 flexbox 来实现这个结果,但显然这是不可能的。 :( 我想只有一些小改动需要应用,请查看图片:ibb.co/J5qFRbq, ibb.co/6yth0Vc, ibb.co/c2BPFLF 如果它有帮助,不要忘记接受并投票 :) 我也是网格新手,所以很高兴听到它有效 新评论只是为了更好地解释。手机:照片现在显示得太小,旁边有文字,而文字应该和照片一样长,并出现在下方。平板电脑:照片下方的文字太小,应该和照片一样长。也许它仍然太宽了?我正在考虑减小宽度,也许......桌面:左列似乎没有与顶部的右列对齐......也许我会减小表单的宽度,你怎么看? :) 是的,这可能工作得很好,因为网格的工作方式,它很灵活,所以这意味着它应该工作:)以上是关于使用 flexbox 的响应式投资组合/联系人的主要内容,如果未能解决你的问题,请参考以下文章