How to hide last divider in list of comments using CSS?
Tags: css,ruby-on-rails-3,html,divider
Problem :
I want to hide last divider between comments using css. Code is below.
<div id="question_comments" class="comments_container">
<div class="comment">
<div class="comment_details">
<div>
<p>Comment1</p>
</div>
</div>
</div>
<div class="hr-comment"></div>
<div class="comment">
<div class="comment_details">
<div>
<p>Comment2</p>
</div>
</div>
</div>
<div class="hr-comment"></div>
<div id="question_comment">
<form> ... </form>
</div>
<div class="clear"></div>
</div>
I am generating that in rails view:
<div id="question_comments" class="comments_container">
<% @question.comments.order("created_at ASC").each do |comment| %>
<%= render :partial => "questions/comment", :locals => { :comment => comment } %>
<div class="hr-comment"></div>
<% end %>
<%= render :partial => 'new_comment', :locals => {:targit => @question, :answer => nil} %>
<div class="clear"></div>
</div>
I tried that:
div.hr-comment {
background:url(hr-background.gif) repeat-x;width:100%;height:2px;margin-top:7px;margin-bottom:7px;width:310px;
}
.hr-comment:last-child {
display: none
}
Goal is how to do that without using ruby in view.
Solution :
It's generally frowned upon to add extra markup like empty divs purely for styling purposes.
.comment + .comment:before {
border-top:1px solid;
max-width: 300px;
margin: 0 auto;
content: " ";
display: block;
}
The adjacent selector has greater support in older browsers than pseudo classes like :last-child
(not available in IE8) or :last-of-type
. The :before
psuedo class has fairly decent support (not available IE7).
CSS Howto..
an asp:DropDownList is rendered as a select in HTML. So, to implement the focus CSS on all drop-downs, add the following to your CSS rules: select:focus{} So your code becomes...
When you create the link html you will need to specify the css class based on the file type you are linking to eg: <a class="document" href="http://someurl.com/some/file/worddoc.doc" title="Your file size...
Hi each word is rotated every 3 seconds, you need to add css for the last span you have added with delay of plus 3 seconds in this case 18s...
Simple MVP const buttons = Array.from(document.querySelectorAll('.button')) const count = buttons.length const increase = Math.PI * 2 / buttons.length const radius = 150 buttons.forEach((button, i) => { button.style.top = Math.sin(-Math.PI /...
I've been having the same issue. I'm not sure my solution is all that great, but I'll post it to see if we can get some discussion started. .icon {...
Using the width to calculate the percentage is correct behavior. You cannot set a margin based on a percentage of the height. One possibility is to set position: absolute; top...
I created a jsFiddle of your online markup. The solution is to have a z-index value for the left block of text, i.e. .left and .left-text so that it covers...
If you're using wp_list_pages(), you can use the classes current_page_item, current_page_ancestor and current_page_parent to target the active nodes. Otherwise a bit of manual labour is at stake - you could...
If you want the transition to happen on load, I suspect you'll need to use animations rather than transitions. For example, if you want the inner div to shrink from...
Try this http://plnkr.co/edit/06lYcyqGYn5IC6U9N3uR?p=preview .add-podcast-btn { margin-top: 100px; margin-left: 100px; font-size: 11px; text-align: center; width: 25px; height: 25px; position: relative; } .glyphicon-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,...
The usual solution is to edit the video so that the end-to-beginning transition looks smoother. Unfortunately, on some browsers, it may pause for a second before it restarts. See this...
/* third level */ #nav li ul li ul {} ...
I'm not entirely sure whether what you want to achieve is, to all intents and purposes, a grid layout? it sounds like it is, in which case .... you need...
You can solve it using relative position for both. But just change their z-index. #search-icon { background-color:#455a21; height:60px; width:60px; border:thin solid black; border-radius:30px; z-index:100; position: absolute; z-index: 2; } input#search...
Cake is still PHP. You must add link do css in head of html file (.ctp view file). There are two ways, write link tag with rel and src attributes...
Try background-image:url(xxx.png); border:none; background-color:transparent; Not only "background"...
You have to set a height on your sidebar and then tell the overflowing content to scroll. Something like this should work: #sidebar { height: 600px; /* or whatever height...
No % is relative depending on the parents height. If you want to set it based on some other div you will need to get that div's height then set...
This isn't possible because position: relative makes the element render normally, then shift, so the fieldset "thinks" the element is in its normal-rendered state. The only real option to fix...
Try this: index.html <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css" /> </head> <body ng-app="myApp"> <div ng-controller="newcontroller"> <div ng-class="[myclass]">welcome</div> <button ng-click="newfunction()">click</button>...
The Web Developer Toolbar helps me a lot with this. Just do Ctrl+Shift+F, click the element of interest and check the element chain in the bottom of the toolbar or...
Here is solution: $(function() { var max = 400; var $slider = $('.slider'); function set(a, b) { $slider[0].style.setProperty("--from", (a / max) * 100); $slider[0].style.setProperty("--to", (b / max) * 100); }...
You can do it easily with CSS (no need of Javascript) span:nth-child(n+4) { display:none; // hide all spans starting from 4th child } ul:nth-child(n+5) { display:none; // hide all uls...
the selector you're looking for is: #cssmenu ul > li > ul > li:hover > ul { right: 1170px; } I'm not seeing all the CSS here but this seems...
All you have to do is to change border-radius: 40px to border-radius: 50%. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" /> <title>Oval</title> <style type="text/css"> .oval { width: 160px; height:...
You should try to add position fixed property to Your background , it should help. body, html, main { /* important */ height: 100%; } .fixed-bg { min-height: 100%; background-size:...
TL;DR; version: this fiddle shows the answer. I understand what you mean. And I am pretty sure that the styling to which you need an answer to, which works...
How about using <nobr> tag #thumbnail-wrap { width: 150%; padding: 5px; max-height: 85px; } #thumbnail-wrap img { max-height: 75px; display: inline; opacity: 0.5; filter: alpha(opacity=50); cursor: pointer; } <div id="gallery-wrap">...
If you want to keep the box heights equal and prevent overflow you could set the height and overflow properties in CSS for your box class: .boxes { height:500px; overflow:...
The way I have deployed custom CSS is to package it as a theme in "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES". The easiest solution is to copy a theme folder,...