2014-11-25 57 views
0

在我的网站中,我有一张图像,下方有文字。文字宽度受其上方图像的100px宽度限制。我宁愿文字宽度与图像宽度无关。这是我的代码。文字宽度受图像的限制

HTML:

<div class="col-md-3"> 
    <div class="customizing text-center"> 

    <span class="process-icon icustomize">&nbsp;</col> 
     <h4>Customizing</h4> 
     <p class="text-center">We create custom 
      there is random text here.</p> 
     <a href="#" class="btn btn-default">Read More</a> 
    </div> 
</div> 

CSS:

.process-icon{ 

    display: inline-block; 
    height: 100px; 
    width: 100px; 
    background: transparent url(img/process-sprite.png) no-repeat; 
    background-position: top left; 
} 
+1

这不是一个图像这是限制性的宽度;你的CSS规则中有一个宽度属性。你试图达到什么目标? – PavKR 2014-11-25 09:39:13

+1

我认为问题在于你没有''的结束标记。 – Chryb 2014-11-25 09:41:17

+0

我有4个图像连续100px并排(总共400px)。图像分布在整个页面上,每个新图标移动-100px-200px和-300px以显示不同的图标。我在每个图标下都有文字,但我希望文字比图标更宽。 – Brandon 2014-11-25 09:44:33

回答

0

您已设置的宽度值,所以它不是导致此图像。正如您在评论中提到的,您尚未正确关闭"<span>"标签。

添加

</span>

这将解决这个文本图像下面要对齐,然后改变你的代码如下。

width: 100px; 

    To 

    width: 100%; //can be whatever you need 

FIDDLE