【发布时间】:2014-11-12 14:48:18
【问题描述】:
我创建了以下 div 样式的 2 个按钮:
.btn-section{
display: inline;
}
这是gsp文件中的代码:
<div class="btn-section feed-meta">
<g:if test="${currentUser != null}">
<likeable:button bean="${statusMessage}" user="${currentUser}" source="news" directLink="${directLink}"
cssClass=" btn-tertiary"/>
</g:if>
<g:if test="${directLink != 'true'}">
<a href="#" class="comment-toggle btn-tertiary">Comment</a>
</g:if>
</div>
btn-tertiary 的 css 是:
.btn-tertiary{
padding:15px 25px 15px 25px;
background-color:#f2f2f2;
font-family:"font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif";
font-weight:400!important;
font-size:13px!important;
color: #444!important;
border:none;
}
我无法将它们以相同的宽度相邻放置。
p.s 按钮的 div 应该是屏幕的宽度
div class="mod activities home">
<div class="mod head update">
<a href="/threebaysover/profile?id=Ng%3D%3D" class="avatar-image square">
<img src="http://331e84836dff4bcefe4c-0b83aa77f26cb44bf666af6296cf13e3.r75.cf2.rackcdn.com/c957b62d-b771-40b0-97a9-f8508b3d6487.jpg" alt="Avatar" onerror="this.src='http://c663375.r75.cf2.rackcdn.com/no-avatar.png'"/>
</a>
<span class="profile-tool-tip dotted" url="/threebaysover/profile/profileTooltip/Ng%3D%3D"><a href="/threebaysover/profile?id=Ng%3D%3D" class="title-default">Sarit Rotshild</a></span>
<span class="text-light">
</br>
4 hours ago
</span>
</div>
<div class="mod-body feed feed-238 comment-1" url="/threebaysover/news/addComment" status="238" data-remove-url="/threebaysover/news/removeComment">
<p class="max-length">
vbcbcvbvcbcvcv
</p>
<div class="text-small" style="padding-bottom: 15px">
<div id="postSummery-238">likes <span id="likeNum-238">2</span>
comments <span id="commentNum-238"> 1</span></div>likes 2comments 1
</div>
<div class="btn-section feed-meta">
<span id="8-user-238-news"><a class=" btn-tertiary" onclick="jQuery.ajax({type:'POST',data:{'subjectId': '8','subjectType': 'user','targetId': '238','targetType': 'news','cssClass': ' btn-tertiary','alternateCssClass': 'null'}, url:'/threebaysover/likeable/unlike',success:function(data,textStatus){jQuery('#8-user-238-news').html(data);},error:function(XMLHttpRequest,textStatus,errorThrown){}});completeLike(238,true,false);">Unlike</a></span>
<a href="#" class="comment-toggle btn-tertiary" >Comment</a>
<div class="feed-like">
<div class="feed-comments">
【问题讨论】:
-
从您的
.gsp发布生成的html,如果可能的话,创建一个jsfiddle -
@vcarvalho- 我写了 html.. 它是 .gsp 的一部分
-
是的,我知道,但我不知道
<likeable:button会生成什么html。在浏览器中打开页面 -> 右键单击 -> 显示源代码,然后发布 html。