[英]Having trouble with my css
Can seem to be able to move the image around, I need the image and the text side-by-side and it is, but I would like to be able to move the image done just a little bit so that the middle part or the image is lined up with the text. 似乎能够左右移动图像,我确实需要并排放置图像和文本,但是我希望能够稍微移动一下图像,以便中间部分或图像与文本对齐。 Right now it is the bottom and no matter what I do it wont move up or down, here is the html for the div and then the css
现在它是底部,无论我做什么都不会上下移动,这是div的html,然后是css
<div class="img">
<img src="/image/file/location">
<div class="imgwording">
<img src="/image/file/location" class="logoimage">
Test Text
</div>
<div class="sub">
<img src="/image/file/location" class="mail">
Test Text
</div>
<div class="imagelinks1">
Training &</br>Events
</div>
<div class="imagelinks2">
Trauma & Gender</br>Projects
</div>
<div class="imagelinks3">
Behavioral Health</br>Resources
</div>
</div>
CSS: CSS:
.imgwording {
text-decoration: none !important;
line-height: 1.28;
letter-spacing: 1.5px;
text-align: center;
font-size: 48px;
padding: 0px 60px !important;
position: absolute;
top: 65px;
width: 100%;
font-family: eb garamond,serif;
color: #fff;
display:flex;
justify-content:center;
align-items:center;
flex-direction:column;
left: -110px;
display: inline-block;
}
.logoimage {
width: 50px;
height: 100px;
}
From what I understand, you have an image and text side by side but the image is lower than it should be. 据我了解,您拥有并排的图像和文本,但是图像比应有的低。 What you could do is add
padding-bottom
to the image CSS to change its position. 您可以做的是在图像CSS上添加
padding-bottom
来更改其位置。 How many pixels you would want to move would depends on how much higher you want the image to go. 您要移动多少像素将取决于图像要移动多少。
Basically doing: 基本上在做:
.logoimage {
width: 50px;
height: 100px;
padding-bottom: 5px; /* this could be any value depending */
}
Believe after some digging I got it, just need to add position: relative; 相信经过一番挖掘我就明白了,只需要添加位置即可: to the .logoimage css
到.logoimage CSS
Add vertical-align:middle; 添加vertical-align:middle; to your logoimage class:
到您的徽标图像类:
.logoimage {
width: 50px;
height: 100px;
vertical-align:middle;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.