div+css中 图片和文字对齐

#content{
width:422px;
height:180px;
border-bottom:1px dashed #96c5ef;
}
img{
border:2px solid #ca0000;
float:left;
}
.left{
float:left;
}
.right{
float:right;
width:230px;
font:12px;
}
</style>
</head>

<body>
<div id="content">
<div class="left">
<img src="images/1.jpg">
最新资讯
</div>
<div class="right">
<ul>
<li><a href="#">A股恐慌式跳水重挫3.68% 大盘跌回 </a></li>
<li><a href="#">股指缓慢企稳 黄金板块逆市上涨 </a></li>
<li><a href="#">港股后市堪忧 韩国股市暂停交易 </a></li>
<li><a href="#">中国万亿美债或面临缩水</a> </li>
<li><a href="#">日经指数收低</a> </li>
<li><a href="#">七国集团发联合声明称将保证金融 </a></li>
<li><a href="#">标普或再降美信用评级 </a></li>
</ul>
</div>
</div>
这个代码中 为什么最新资讯没有和图片垂直对齐?我该怎么gai?
你那不行,,


慕姐8265434
浏览 1635回答 2
2回答

慕田峪4524236

</style>&nbsp;#content{&nbsp; &nbsp;width:422px;&nbsp; &nbsp;height:180px;border-bottom:1px dashed #96c5ef;}&nbsp; img{&nbsp; &nbsp; &nbsp; &nbsp; border:2px solid #ca0000;&nbsp; &nbsp; &nbsp; &nbsp; float:left;}.left{float:left;vertical-align:middle;}&nbsp; &nbsp;.right{&nbsp; float:right;&nbsp; width:230px;&nbsp; font:12px;}</style></head><body>&nbsp; &nbsp;<div id="content">&nbsp; &nbsp; &nbsp; <div class="left">  <img src="images/1.jpg"<!--这里是我改动的地方-->align="absmiddle"><!--这里是我改动的地方-->&nbsp; &nbsp; &nbsp; &nbsp;最新资讯&nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; <div class="right">&nbsp; &nbsp; &nbsp; &nbsp; <ul>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="#">A股恐慌式跳水重挫3.68% 大盘跌回 </a></li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="#">股指缓慢企稳 黄金板块逆市上涨 </a></li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="#">港股后市堪忧 韩国股市暂停交易 </a></li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="#">中国万亿美债或面临缩水</a> </li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="#">日经指数收低</a> </li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="#">七国集团发联合声明称将保证金融 </a></li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="#">标普或再降美信用评级 </a></li>&nbsp; &nbsp; &nbsp; &nbsp; </ul>&nbsp; &nbsp; </div>&nbsp; </div></body></html>最终的图片
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

CSS3