Html 如何将段落内容和标题内容与日期对齐?浮球:对不对
我的目标是将标题与日期下方的内容对齐。我试着使用float:right并使用边距和填充,但似乎不起作用Html 如何将段落内容和标题内容与日期对齐?浮球:对不对,html,css,Html,Css,我的目标是将标题与日期下方的内容对齐。我试着使用float:right并使用边距和填充,但似乎不起作用 <div class="content container_12"> <ul id="list-content"> <li> <img src="images/img_thumbnail1.png" alt="inferno cape"> <
<div class="content container_12">
<ul id="list-content">
<li> <img src="images/img_thumbnail1.png" alt="inferno cape">
<!-- <time datetime="2017-01-01" class="text-content">Game Updates | January 1st, 2017</time> -->
<h2 class="header-content text-content">This is a heading</h2>
<p class="paragraph-content text-content">This is the content</p>
</li>
<li> <img src="images/img_thumbnail2.png" alt="find option">
<!-- <time datetime="2017-01-01" class="paragraph-content text-content">Game Updates | November 17th 2016</time> -->
</li>
<li> <img src="images/img_thumbnail3.png" alt="duel arena">
<!-- <time datetime="2017-01-01" class="paragraph-content text-content">Game Updates | October 17th 2015</time> -->
</li>
</ul>
</div>
根据您预期的行为图像,下面是实现所需功能的代码片段。基本上,您需要: 将标题、时间和段落包装到一个容器中。 向左浮动image,向右浮动.desc我想这就是你们想要的,但若你们想把image和.desc放在一起,你们可以向左浮动.desc。 使用清楚:均在:伪元素后的li,给li元素高度。 * { 保证金:0; } .内容{ 背景色:3d4b5b; } 列表内容李{ 列表样式类型:无; 垫面:2米; } 列表内容LIIMG{ 宽度:200px; 浮动:左; } 列表内容li.desc{ 浮动:对; } 列表内容li.desc.text内容{ 边缘底部:5px; 显示:块; } 列表内容李:之后{ 内容:; 明确:两者皆有; 显示:块; } 这是一个标题 游戏更新| 2017年1月1日
这是内容
这是一个标题 游戏更新| 2017年1月1日这是内容
这是一个标题 游戏更新| 2017年1月1日这是内容
你能提供一些预期的行为形象吗?日期下面有点模糊。这就是我的目标。Ye,这是个好人,但我通过使用flex属性并在每个新元素中添加一个列表项来解决这个问题,它也解决了我的问题:D干杯:这正是我想要的结果^^
.content {
background-color: #3d4b5b;
}
#list-content li img {
list-style-type: none;
margin-left: -50px;
width: 300px;
height: 200px;
padding-top: 2em;
list-style-type: none;
}
.text-content{
float: right;
margin:0;
}
.header-content {
font-size: 1.5em;
-webkit-margin-before: 0;
-webkit-margin-after: 0;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
font-weight: bold;
margin:0;
}
.paragraph-content{
float: right;
}
time{
padding-top:40px;
padding-right: 40px;
margin:0;
}