2016-05-30 62 views
4

如何修复div块上的计数文本?更改屏幕尺寸时出现问题。如何修复元素

普通

enter image description here

在屏幕上调整

enter image description here

验证码:

span.right-corner{ 
 
    position: relative; 
 
    float: left; 
 
    left: 250px; 
 
    bottom: 25px; 
 
    width: auto; 
 
} 
 
div.top-block{ 
 
    position: relative; 
 
    float: left; 
 
    left: 240px; 
 
    bottom: 40px; 
 
    width: auto; 
 
}
<div class="col-sm-4"> 
 
    <div class="top-block"> 
 
    <div class="huge"><i class="fa fa-book"></i></div> 
 
    </div> 
 
    <div class="well"> 
 
    <span class="badge right-corner">${count}</span> 
 
    <h4>Архів</h4> 
 
    <a class="watcher" href="/edocs/main/archive/${offnoteType}"></a> 
 
    </div> 
 
</div>

+1

你的问题和代码是不明确的。你想要做什么? –

+0

什么是你的预期输出..? – Muthu

回答

1

下一次请粘贴工作的代码更容易让我们尝试帮助您。

Check this solution

而不是使用浮动(我不建议...只是少数特定情况下) 我觉得跟位置相对和绝对是您的情况更容易。

调整大小并查看“通知”块始终位于其容器右上角。

  • position: relative

  • 绝对子容器:position: absolute; right: 0; top: 0;

现在你只需要使用的填充发挥,实现了良好的设计。

提示:会是如果使用语义化的HTML代替1048105715个div的为您做得更好;)