如何使用CSS将名称David Laecke放在停止图像下?
现在,David Laecke的文本取决于右边文本的增长程度,以便当右边的文本增长时名称被推下来,但我希望它独立于右边的文本。
我已将其设为div
,然后我将其更改为span
并将width
更改为更少,但我可以看到由于某种原因占用了所有空间到了元素的另一边,这就是为什么被推倒了。
我该怎么办?任何帮助,将不胜感激。
我的HTML代码:
<h4>
<form method='post' id='deleteinsight-2' action="insights.php?chapter=1" data-ajax='false'> <input type='hidden' name='deleteinsightinput' value='2'>
<a href='#' data-rel='back' data-role='button' data-icon='delete' data-iconpos='notext' onclick='deleteinsight(this,event);' style='position:absolute;top:-20px;right: -10px' >Delete</a>
</form>
<div class='ui-grid-a'>
<div class='ui-block-a textfloatleft' > 1 new </div>
<div class='ui-block-b textfloatright'> Jan 27 2016, 12:25 pm </div>
</div>
<div class='ui-grid-b' style='width:900px;'>
<div class='ui-block-a' id='blocka'>
<img id='imguser' src='http://www.testingcolorvision.com/widget/core/restart.png'>
</div>
<div class='ui-block-b' id='blockb'>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecen</div>
<div class='ui-block-c' id='blockc'>
<button id='btn01' href='#' data-icon='check' data-iconpos='right' style='width:100px;' onclick='showtextarea(this,2)' >Reply</button>
</div>
</div>
<span id='namefirstlast'>David Laecke </span>
</h4>
答案 0 :(得分:1)
只需将名称与图像放在同一个<div>
中即可,
像这样:
<div class='ui-block-a' id='blocks'>
<img id='imguser' src='http://www.testingcolorvision.com/widget/core/restart.png'>
<br />
<span id='namefirstlast'>David Laecke </span>
</div>