Monday, 15 February 2010

ruby on rails - CSS only targetting first line in a comment -



ruby on rails - CSS only targetting first line in a comment -

so have comments in app , issue 1 time content in comment becomes 3 lines wraps below users image instead of starting other lines do. i'm pretty new css seems whatever margins apply moves first line.

css:

#comment_border { border: 1px solid $graylighter; border-radius: 3px; background-color: #d6e5f1; margin-left: 90px; padding: 2px; } .comment_info { display: block; margin-left: -20px; color: #767676; } #comment_content { /* dont know set here */ }

view/comments:

<div class="row" id="comment_border"> <span class="comment_info"> <aside class="span2"> <%= link_to gravatar_for((comment.user), size: 35), comment.user %> <%= link_to comment.user.name, comment.user, id: "feedusername" %> </aside> <span id="comment_content"> <%= comment.content %> </span> </span> </div>

the problem description incomplete (essential css missing etc.), main problem seems setting left margin on inline element. given markup, next css modifications render in way seems meant:

.comment_info { display: block; margin-left: 0px; color: #767676; /* margin-left:-20px; not set here */ } #comment_content { margin-left: 90px; display: block; } .span2 { width: 80px; height: 35px; float: left; border: solid 1px red; }

it more logical utilize div element , not span comment content; doing so, drop display: block declaration.

p.s. shouldn’t utilize aside here; it’s not meant purposes this, , confuses old browsers; utilize div instead.

css ruby-on-rails

No comments:

Post a Comment