请问一个换行的问题

MeadaAtsuko 2017-07-21 11:20:05

上面的图片 我想让 “123图片” 放在“夏天来了又走了”的后面 但是a标签虽然设置了inline-block 但是还是会独占一行

如果都改成行内元素的话 a标签的行高总是莫名的增加

代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>行高</title>
<style type="text/css">
*{
margin:0px;
padding: 0px;
}
div{
width: 170px;
height: 250px;
margin:10px auto;
}
img{
display: inline-block;
width: 170px;
height: 170px;
vertical-align: top;
}
div a{
display: inline-block;
font: 12px/19px arial;
text-decoration: none;
color: #37a;
vertical-align: top;
float: left;
}
div span{
display: inline-block;
font: 12px/19px arial;
color:#999;
vertical-align: top;
float: right;
}
</style>
</head>
<body>
<div>
<img src="images/1.webp"><a href="#">夏天来了又走了夏天来了又走了夏天来了又走了</a><span>123张照片</span>
</div>
</body>
</html>
...全文
260 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
血界 2017-09-24
  • 打赏
  • 举报
回复


是这样吗
天际的海浪 2017-07-21
  • 打赏
  • 举报
回复

*{
margin:0px;
padding: 0px;
}
div{
width: 170px;
height: 250px;
margin:10px auto;
font: 12px/15px arial;
}
img{
display: inline-block;
width: 170px;
height: 170px;
vertical-align: top;
}
div a{
text-decoration: none;
color: #37a;
}
div span{
color:#999;
float: right;
}

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧