我正在为 rgba 颜色使用不透明度参数,只有最后一个子元素提供我想要的颜色,每个其他边框显示不同的颜色。您甚至可以在 devtools 中通过颜色选择器对其进行测试。
body {
background-color: black;
}
.content > table {
width: 100%;
border-collapse: collapse;
color: white;
}
.content > table > tbody > tr.topic {
height: 50px;
border-bottom: 1px solid rgba(16, 151, 255, 0.41);
}<div class="content">
<table>
<tbody>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
</tbody>
</table>
</div>
最佳答案
在我看来,这是 chrome 浏览器中的一个错误。
另一种方法是使用 background-image 而不是 border-bottom。
我们可以使用linear-gradient()达到同样的效果。
.content > table > tbody > tr.topic {
background-image: linear-gradient(rgba(16, 151, 255, 0.41), rgba(16, 151, 255, 0.41));
background-repeat: no-repeat;
background-position: left bottom;
background-size: 100% 1px;
}
工作演示:
body {
background-color: black;
}
.content > table {
width: 100%;
border-collapse: collapse;
color: white;
}
.content > table > tbody > tr.topic {
height: 50px;
background-image: linear-gradient(rgba(16, 151, 255, 0.41), rgba(16, 151, 255, 0.41));
background-repeat: no-repeat;
background-position: left bottom;
background-size: 100% 1px;
}<div class="content">
<table>
<tbody>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
<tr class="topic">
<td class="topic-title">
<i class="topic-icon"></i>
Title
</td>
<td class="topic-replies">
<i class="replies-icon"></i>
15
</td>
<td class="topic-author">
Name
</td>
<td class="topic-timestamp">
<time>20m.</time>
</td>
</tr>
</tbody>
</table>
</div>
关于html - 边框颜色不透明度对表格行的作用不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45438633/
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这
如果您尝试在Ruby中的nil对象上调用方法,则会出现NoMethodError异常并显示消息:"undefinedmethod‘...’fornil:NilClass"然而,有一个tryRails中的方法,如果它被发送到一个nil对象,它只返回nil:require'rubygems'require'active_support/all'nil.try(:nonexisting_method)#noNoMethodErrorexceptionanymore那么try如何在内部工作以防止该异常? 最佳答案 像Ruby中的所有其他对象
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
我正在使用Rails构建一个简单的聊天应用程序。当用户输入url时,我希望将其输出为html链接(即“url”)。我想知道在Ruby中是否有任何库或众所周知的方法可以做到这一点。如果没有,我有一些不错的正则表达式示例代码可以使用... 最佳答案 查看auto_linkRails提供的辅助方法。这会将所有URL和电子邮件地址变成可点击的链接(htmlanchor标记)。这是文档中的代码示例。auto_link("Gotohttp://www.rubyonrails.organdsayhellotodavid@loudthinking.
我正在学习http://ruby.railstutorial.org/chapters/static-pages上的RubyonRails教程并遇到以下错误StaticPagesHomepageshouldhavethecontent'SampleApp'Failure/Error:page.shouldhave_content('SampleApp')Capybara::ElementNotFound:Unabletofindxpath"/html"#(eval):2:in`text'#./spec/requests/static_pages_spec.rb:7:in`(root)'
我正在尝试用Prawn生成PDF。在我的PDF模板中,我有带单元格的表格。在其中一个单元格中,我有一个电子邮件地址:cell_email=pdf.make_cell(:content=>booking.user_email,:border_width=>0)我想让电子邮件链接到“mailto”链接。我知道我可以这样链接:pdf.formatted_text([{:text=>booking.user_email,:link=>"mailto:#{booking.user_email}"}])但是将这两行组合起来(将格式化文本作为内容)不起作用:cell_email=pdf.make_c
我正在尝试将一个简单的CSV文件读入HTML表格以在浏览器中显示,但我遇到了麻烦。这就是我正在尝试的:Controller:defshow@csv=CSV.open("file.csv",:headers=>true)end查看:输出:NameStartDateEndDateQuantityPostalCode基本上我只获取标题,而不会读取和呈现CSV正文。 最佳答案 这最终成为最终解决方案:Controller:defshow#OpenaCSVfile,andthenreaditintoaCSV::Tableobjectforda
我基本上来自Java背景并且努力理解Ruby中的模运算。(5%3)(-5%3)(5%-3)(-5%-3)Java中的上述操作产生,2个-22个-2但在Ruby中,相同的表达式会产生21个-1-2.Ruby在逻辑上有多擅长这个?模块操作在Ruby中是如何实现的?如果将同一个操作定义为一个web服务,两个服务如何匹配逻辑。 最佳答案 在Java中,模运算的结果与被除数的符号相同。在Ruby中,它与除数的符号相同。remainder()在Ruby中与被除数的符号相同。您可能还想引用modulooperation.
RSpec似乎按顺序匹配方法接收的消息。我不确定如何使以下代码工作:allow(a).toreceive(:f)expect(a).toreceive(:f).with(2)a.f(1)a.f(2)a.f(3)我问的原因是a.f的一些调用是由我的代码的上层控制的,所以我不能对这些方法调用添加期望。 最佳答案 RSpecspy是测试这种情况的一种方式。要监视一个方法,用allowstub,除了方法名称之外没有任何约束,调用该方法,然后expect确切的方法调用。例如:allow(a).toreceive(:f)a.f(2)a.f(1)