gpt4 book ai didi

html - 如何放置 float : right; Font Awesome icon on same line?

转载 作者:搜寻专家 更新时间:2023-10-31 23:24:50 24 4
gpt4 key购买 nike

在下面的代码中应用 float: right;在 i 标签上,Font Awesome 图标箭头向右但不在同一行。

我希望箭头应该像附图一样在同一行上。

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

<style type="text/css">

.content {
display: block;
margin: 0 auto;
height: 40px;
line-height: 40px;
width: 300px;
padding: 0px 20px 0px 20px;
border: 1px solid red;
}

div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 40px;
}

i {
float: right;
color: green;
display: inline-block;
}

</style>
</head>
<body>

<a class="content" href="/United Arab Emrits">
<div>National and world news with background material, activities, discussion starters and teaching guides.</div>
<i class="fa fa-chevron-circle-right"></i>
</a>

</body>
</html>

In the code above the output should be like attached image.

最佳答案

您的 HTML 应该是这样的,我们可以将 line-height 添加到图标类中:

 <a class="content" href="/United Arab Emrits">
<i class="fa fa-chevron-circle-right my-icon"></i>
<div>National and world news with background material, activities, discussion starters and teaching guides.
</div>
</a>

并将此样式添加到您的 CSS:

.my-icon{
line-height:40px;
}

工作 fiddle :http://jsfiddle.net/sandenay/L4pkc07e/2/

关于html - 如何放置 float : right; Font Awesome icon on same line?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33066218/

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