Html 浮动图像向左,文本居中对齐。在图像之后,链接不';不要排队
更新:在我的页面顶部,我有一个图像向左浮动。在它旁边,我有一个文本对齐的链接列表:居中;在图像之后,最后一个链接居中,尽管它在div上居中,而不是从左侧浮动的图像居中 以下是更新的小提琴的链接: CSS:Html 浮动图像向左,文本居中对齐。在图像之后,链接不';不要排队,html,css,image,css-float,Html,Css,Image,Css Float,更新:在我的页面顶部,我有一个图像向左浮动。在它旁边,我有一个文本对齐的链接列表:居中;在图像之后,最后一个链接居中,尽管它在div上居中,而不是从左侧浮动的图像居中 以下是更新的小提琴的链接: CSS: h2 {text-align: center; color: blue; } h2 a { text-align: center; } a.link { color: #00008A; text-decoration: underline;
h2 {text-align: center;
color: blue;
}
h2 a {
text-align: center;
}
a.link {
color: #00008A;
text-decoration: underline;
display: inline-block;
}
a.link:hover{
color: orange;
font-size: 150%;
}
div.logo {
float: left;
width: 30%;
}
div.links {
float: right;
width: 70%;
}
HTML:
<div class="logo">
<a href=https://answers.aseba.org/>
<img src="http://www.aseba.org/graphics/ASEBA%20Logosmall.jpg" alt="ASEBA Logo">
</a>
</div>
<div class="links">
<h2>
<strong>
<a class="link" href="https://answers.aseba.org/category/aseba-web">ASEBA-WEB Knowledgebase</a>
</strong>
</h2>
<br>
<h2>
<strong>
<a class="link" href="https://answers.aseba.org/category/aseba-pc">ASEBA-PC Knowledgebase</a>
</strong>
</h2>
<br>
<h2>
<strong>
<a class="link" href="https://answers.aseba.org/category/aseba-network">ASEBA-Network Knowledgebase</a>
</strong>
</h2>
<br>
<h2>
<strong>
<a class="link" href="https://www.youtube.com/channel/UCIzvez_ZzkpM83-kInJX1HQ" target="_blank">ASEBA Support YouTube Channel!</a>
</strong>
</h2>
<br>
<h2>
<strong>
<a class="link" href="https://answers.aseba.org/">Complete ASEBA Knowledgebase</a>
</strong>
<br>
</h2>
</div>
<hr>
我意识到我有几个选择。一种方法是创建一个“空白”元素,该元素在图像下方向左浮动,宽度与图像本身相同。另一个是把商标改大
如何才能使链接相对于徽标保持在中心浮动
谢谢 试试这个
h2{文本对齐:居中;
颜色:蓝色;
}
h2 a{
文本对齐:居中;
}
a、 链接{
颜色:#00008A;
文字装饰:下划线;
显示:内联块;
}
a、 链接:悬停{
颜色:橙色;
字体大小:150%;
}
部门标志{
宽度:30%;
浮动:左;
}
部门链接{
宽度:70%;
浮动:对;
}
我认为您需要在链接周围添加一个div,然后在两个链接周围添加一个包含div的div
请看这里:
仅更改:
div.logo {
float: left;
margin-bottom: 100%;
}
它并不优雅,但请尝试:
div.logo {
float: left;
height: 800px;
}
你想让徽标在左边,链接在徽标底部居中吗?我想让图像在左边,链接相对于徽标居中。。。在小提琴中,您注意到前两个链接相对于徽标居中,下面的链接相对于div居中。检查此项并告诉我这是您想要的吗?这是因为div的高度。将div.logo的高度设置为5000px,你就会明白我的意思。你需要分类that@john_h请检查我的小提琴它的更新这是完美的,因为现在我不需要担心的高度,如果我添加更多的链接。非常感谢你的帮助!谢谢,如果对你有帮助的话,请接受这个答案,巴迪@john\h
div.logo {
float: left;
margin-bottom: 100%;
}
div.logo {
float: left;
height: 800px;
}