我是html的新手。我正在尝试使用html并排显示图像。
我知道使用以下代码:
<div style="float:left;">
<img alt="logo" src="images/logo.gif" />
<img alt="background" src="images/bkgd.gif" />
</div>
所有img标签都在div标签中。
但在我的代码中,我为不同的图像采用了不同的div标签。
<div style="float:left;">
<li class="gallerybox" style="width: 185px">
<div style="width: 185px">
<div class="thumb" style="width: 180px;">
<div style="margin:19.5px auto;">
<a href="http://en.wikipedia.org/wiki/File:Marathahalli.jpg" class="image"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Marathahalli.jpg/150px-Marathahalli.jpg" width="150" height="91"></a>
</div>
</div>
<div class="gallerytext">
<p>View of Outer ring road from Marathahalli bridge</p>
</div>
</div>
</li>
<li class="gallerybox" style="width: 185px">
<div style="width: 185px">
<div class="thumb" style="width: 180px;">
<div style="margin:15px auto;">
<a href="http://en.wikipedia.org/wiki/File:Marathahalli_ring_road_side_view_8140.JPG" class="image"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/Marathahalli_ring_road_side_view_8140.JPG/133px-Marathahalli_ring_road_side_view_8140.JPG" width="133" height="100"></a>
</div>
</div>
<div class="gallerytext">
<p>Marathahalli ORR</p>
</div>
</div>
</li>
<li class="gallerybox" style="width: 185px">
<div style="width: 185px">
<div class="thumb" style="width: 180px;">
<div style="margin:15px auto;">
<a href="http://en.wikipedia.org/wiki/File:Marathahalli_ring_road_side_view_8138.JPG" class="image"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/37/Marathahalli_ring_road_side_view_8138.JPG/133px-Marathahalli_ring_road_side_view_8138.JPG" width="133" height="100"></a>
</div>
</div>
<div class="gallerytext">
<p>Marathahalli ORR side snap</p>
</div>
</div>
</li>
<li class="gallerybox" style="width: 185px">
<div style="width: 185px">
<div class="thumb" style="width: 180px;">
<div style="margin:15px auto;">
<a href="http://en.wikipedia.org/wiki/File:Marathahalli_ring_road_side_view_8151.JPG" class="image"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Marathahalli_ring_road_side_view_8151.JPG/133px-Marathahalli_ring_road_side_view_8151.JPG" width="133" height="100"></a>
</div>
</div>
<div class="gallerytext">
<p>Innovative multiplex theater</p>
</div>
</div>
</li>
<li class="gallerybox" style="width: 185px">
<div style="width: 185px">
<div class="thumb" style="width: 180px;">
<div style="margin:15px auto;">
<a href="http://en.wikipedia.org/wiki/File:Marathahalli_ring_road_side_view_8149.JPG" class="image"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/40/Marathahalli_ring_road_side_view_8149.JPG/133px-Marathahalli_ring_road_side_view_8149.JPG" width="133" height="100"></a>
</div>
</div>
<div class="gallerytext">
<p>Aisshwaria Opulance Apartment at Marathahalli ring road</p>
</div>
</div>
</li>
</div>
请帮帮我。
答案 0 :(得分:2)
试试这个:
li {
float: left;
}
答案 1 :(得分:1)
我实际上并不了解您希望代码执行的操作。但我仍然认为这可能(可能不会)帮助你。 (使用类和内部CSS样式不是内联的)
<div class='img-container'>
<img src='image.jpg'/>
<img src='image2.jpg'/>
</div>
用于制作图像的CSS并排显示:
.img-container img {
display:inline-block;
width:100px; /* or whatever you want*/
height:100px; /* same as above */
}
如果这不是您要查找的内容,请创建fiddle并使用链接更新您的问题。