gpt4 book ai didi

html - 试图垂直对齐文章内的内容但无法弄清楚

转载 作者:行者123 更新时间:2023-11-28 15:08:29 26 4
gpt4 key购买 nike

试图垂直对齐文章中的内容,但无法弄清楚。我试过使用表格和垂直对齐,但似乎无法正常工作。不过我对任何事情都持开放态度。我只希望它能够响应并在右侧完美居中。

左边明显有图片进去,不知道怎么插入。它很适合排成一行,但不明白如何垂直对齐文章中的内容。

如果有人能帮助我,那就太棒了!谢谢:)

#employee-profile {
position: relative;
}

img {
display: inline-block;
width: 40%;
}

#employee-profile-info {
display: inline-block;
position: absolute;
width: 60%;
height: calc(100% - 4px);
box-sizing: border-box;
padding: 40px;
border: 3px solid black;
margin: auto;
vertical-align: middle;
}

a {
display: inline-block;
text-decoration: none;
color: black;
text-align: center;
font-weight: bold;
box-sizing: border-box;
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 2px solid black;
transition: .5s;
}

a:hover {
color: grey;
}

:nth-child(5) {
background: red;
width: 10%;
}

:nth-child(6) {
background: yellow;
width: calc(90% - 5px);
}
<!DOCTYPE html>
<html>
<head>

<link rel="stylesheet" href="main.css">

</head>
<body>

<div id="employee-profile">
<img src="img/pic1.jpeg" alt="pic1">

<div id="employee-profile-info">
<article class="info">
<h3>Cameron Walker </h3>

<h4>Associate Consultant</h4>

<a href="/consultants/cameron-walker"><i class="fa fa-list-ul" aria-hidden="true"></i> View consultant jobs</a>

<a href="mailto:cameron.walker@twentyrecruitment.com"><i class="fa fa-envelope-o" aria-hidden="true"></i>cameron.walker@twentyrecruitment.com</a>

<a target="_blank" href="https://www.linkedin.com/in/cameron-walker-63a73793/"><i class="fa fa-linkedin" aria-hidden="true">In</i></a>

<a href="tel:+44 203 189 4317"><i class="fa fa-phone" aria-hidden="true"></i>+44 203 189 4317</a>

<p class="custom-scroll mCustomScrollbar _mCS_1"> Cameron started at Twenty in August 2017 following the completion of his degree in English from the University of Nottingham.&nbsp;</p>
</article>
</div>
</div>


</body>
</html>

最佳答案

这就是你想要的?从 #employee-profile-info

中移除高度

#employee-profile {
position: relative;
}

img {
display: inline-block;
width: 40%;
}

#employee-profile-info {
display: inline-block;
position: absolute;
width: 60%;
box-sizing: border-box;
padding: 40px;
border: 3px solid black;
margin: auto;
vertical-align: middle;
}

a {
display: inline-block;
text-decoration: none;
color: black;
text-align: center;
font-weight: bold;
box-sizing: border-box;
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 2px solid black;
transition: .5s;
}

a:hover {
color: grey;
}

:nth-child(5) {
background: red;
width: 10%;
}

:nth-child(6) {
background: yellow;
width: calc(90% - 5px);
}
<!DOCTYPE html>
<html>
<head>

<link rel="stylesheet" href="main.css">

</head>
<body>

<div id="employee-profile">
<img src="img/pic1.jpeg" alt="pic1">

<div id="employee-profile-info">
<article class="info">
<h3>Cameron Walker </h3>

<h4>Associate Consultant</h4>

<a href="/consultants/cameron-walker"><i class="fa fa-list-ul" aria-hidden="true"></i> View consultant jobs</a>

<a href="mailto:cameron.walker@twentyrecruitment.com"><i class="fa fa-envelope-o" aria-hidden="true"></i>cameron.walker@twentyrecruitment.com</a>

<a target="_blank" href="https://www.linkedin.com/in/cameron-walker-63a73793/"><i class="fa fa-linkedin" aria-hidden="true">In</i></a>

<a href="tel:+44 203 189 4317"><i class="fa fa-phone" aria-hidden="true"></i>+44 203 189 4317</a>

<p class="custom-scroll mCustomScrollbar _mCS_1"> Cameron started at Twenty in August 2017 following the completion of his degree in English from the University of Nottingham.&nbsp;</p>
</article>
</div>
</div>


</body>
</html>

关于html - 试图垂直对齐文章内的内容但无法弄清楚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48927249/

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