左侧浮动图像右侧的列表

左侧浮动图像右侧的列表

本文介绍了左侧浮动图像右侧的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用外部列表属性在左侧浮动的img的右侧正确定位ul列表,但是子弹不在图像的右侧对齐,因为没有任何图像,但更多

I want to properly position an ul list on the right of a left-floating img using outside list property, but the bullets aren't aligned on the right of the image, as where there isn't any image, but more on the left.

<img style="float: left; margin-right: 0.1em;" src="http://commons.cathopedia.org/w/images/commons/thumb/f/fe/Carnevale_di_Venezia.JPG/250px-Carnevale_di_Venezia.JPG" />
<ul>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit</li>
    <li>Lorem ipsum dolor sit amet, cnsectetur cnsecteturcnsectetur um dolor sit amet, consectetur adipiscing elit</li>
</ul>

查看,以便更好地理解。

See the fiddle for a better understanding.

我无法修改html,只能css。

I cannot modify html, only css.

我不想把list属性放到里面。

I don't want to put the list property to inside.

如果我给图片添加了一个右边距,not-ul文本也被移动了,

If I add a right margin to the image, the not-ul text is moved too, and I don't want it.

如果我添加一个左边距或填充到ul或li,则不在图像右侧的列表将被移动

If I add a left margin or padding to ul or li, the lists which aren't on the right of an image are moved inward too, and I don't want it.

推荐答案

如何管理?

您可以尝试在ul标签中添加溢出隐藏:

You can try with adding overflow hidden in ul tag http://jsfiddle.net/2z6Zn/61/:

ul {
    padding-left: 1.2em;
    overflow: hidden;
}​

这篇关于左侧浮动图像右侧的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 01:28