我有一个有序列表 (ol),它的 display 属性设置为 flex。列表项也呈现为 flexboxes。这样做会导致元素符号(数字)不再显示。
有什么方法可以让元素符号显示在 ol 类 .questions.questions--likert 上(在 40px 的区域padding 是)?
参见 Fiddle(包含 SCSS):http://jsfiddle.net/3y5t0xpx/3/
下面的 HTML 和编译的 CSS:
HTML
<form class="form form--test" name="frm-identification" action="/" method="post">
<fieldset>
<h2>Identificatie</h2>
<p>Gelieve volgende gegevens in te vullen vooraleer de test te starten.</p>
<ol class="questions questions--likert">
<li class="question">
<p class="description">Inventieve ideeen brengen</p>
<ul>
<li><label class="input-container input-container--radio"><input type="radio" name="rbt-t1q1" id="rbt-t1q1-1" value="1" /><span class="value">1</span></label></li>
<li><label class="input-container input-container--radio"><input type="radio" name="rbt-t1q1" id="rbt-t1q1-2" value="2" /><span class="value">2</span></label></li>
<li><label class="input-container input-container--radio"><input type="radio" name="rbt-t1q1" id="rbt-t1q1-3" value="3" /><span class="value">3</span></label></li>
<li><label class="input-container input-container--radio"><input type="radio" name="rbt-t1q1" id="rbt-t1q1-4" value="4" /><span class="value">4</span></label></li>
<li><label class="input-container input-container--radio"><input type="radio" name="rbt-t1q1" id="rbt-t1q1-5" value="5" /><span class="value">5</span></label></li>
<li><label class="input-container input-container--radio"><input type="radio" name="rbt-t1q1" id="rbt-t1q1-6" value="6" /><span class="value">6</span></label></li>
<li><label class="input-container input-container--radio"><input type="radio" name="rbt-t1q1" id="rbt-t1q1-7" value="7" /><span class="value">7</span></label></li>
</ul>
</li>
</ol>
</fieldset>
</form>
编译后的 CSS:
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic);
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after {
content: '';
content: none;
}
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
html {
color: #333;
font: 87.5% 'Open Sans', sans-serif;
}
body {
font-size: 1rem;
line-height: 1.428571429;
}
h1 {
font-weight: 600;
font-size: 20px;
margin-top: 0;
margin-bottom: 10px;
text-transform: uppercase;
}
h2 {
font-size: 18px;
margin-top: 15px;
margin-bottom: 10px;
}
p {
margin: 0 0 10px;
}
ul, ol {
margin-top: 0;
margin-bottom: 10px;
}
ul li, ol li {
margin: 0 0 0 1.5rem;
padding: 0;
}
ol {
list-style: decimal outside none;
}
ul {
list-style: disc outside none;
}
.form input, .form textarea {
font-family: 'Open Sans', sans-serif;
color: #333;
}
.form dl {
padding-top: 10px;
}
.form dl dt, .form dl dd {
padding: 0 0 10px;
margin: 0;
}
.form dl dt {
font-size: 12px;
vertical-align: top;
font-weight: bold;
padding-bottom: 5px;
}
.form dl dt .required {
color: #f00;
}
.form ol {
padding: 0;
margin: 0;
}
.form ol li {
margin: 0;
}
.form fieldset {
padding: 10px 0;
}
.questions {
list-style: decimal outside none;
}
.questions li {
padding-left: 40px;
}
.questions.questions--likert .question {
display: flex;
}
.questions.questions--likert .question .description {
flex: 0 0 300px;
margin: 0;
padding: 0 0 0 40px;
}
.questions.questions--likert .question ul {
display: flex;
flex: 0 0 420px;
list-style: none outside none;
justify-content: space-between;
margin: 0;
padding: 0;
width: 100%;
}
.questions.questions--likert .question ul li {
flex: 1 1 auto;
margin: 0;
padding: 0;
}
.questions.questions--likert .question ul li .input-container {
width: 100%;
}
.input-container.input-container--radio {
border-radius: 6px 6px 0 0;
background: transparent;
cursor: pointer;
display: inline-block;
padding: 10px;
position: relative;
text-align: center;
}
.input-container.input-container--radio:hover {
background-color: #efefef;
}
.input-container.input-container--radio:hover .value {
display: inline-block;
position: absolute;
padding: 5px 10px;
top: 100%;
left: 0;
width: 100%;
}
.input-container.input-container--radio .value {
background: #bfbdbc;
clear: both;
color: #28211e;
display: block;
font-size: 0.857143rem;
text-align: center;
width: 100%;
display: none;
border-radius: 0 0 6px 6px;
box-shadow: inset 0px 3px 2px -2px rgba(0, 0, 0, 0.25);
}
最佳答案
list-style 仅适用于具有 display: list-item 的元素——因此通过使您的 LI display: flex,您将删除list-style 生效的先决条件。
使用计数器可能是最好的选择。
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Lists_and_Counters/Using_CSS_counters
关于html - 呈现为 flexbox 的有序列表不显示元素符号/小数(元素也呈现为 flexbox),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33805682/
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
我得到了一个包含嵌套链接的表单。编辑时链接字段为空的问题。这是我的表格:Editingkategori{:action=>'update',:id=>@konkurrancer.id})do|f|%>'Trackingurl',:style=>'width:500;'%>'Editkonkurrence'%>|我的konkurrencer模型:has_one:link我的链接模型:classLink我的konkurrancer编辑操作:defedit@konkurrancer=Konkurrancer.find(params[:id])@konkurrancer.link_attrib
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
是否有类似“RVMuse1”或“RVMuselist[0]”之类的内容而不是键入整个版本号。在任何时候,我们都会看到一个可能包含5个或更多ruby的列表,我们可以轻松地键入一个数字而不是X.X.X。这也有助于rvmgemset。 最佳答案 这在RVM2.0中是可能的=>https://docs.google.com/document/d/1xW9GeEpLOWPcddDg_hOPvK4oeLxJmU3Q5FiCNT7nTAc/edit?usp=sharing-知道链接的任何人都可以发表评论
在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这
所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择
我试图在索引页中创建一个超链接,但它没有显示,也没有给出任何错误。这是我的index.html.erb代码。ListingarticlesTitleTextssss我检查了我的路线,我认为它们也没有问题。PrefixVerbURIPatternController#Actionwelcome_indexGET/welcome/index(.:format)welcome#indexarticlesGET/articles(.:format)articles#indexPOST/articles(.:format)articles#createnew_articleGET/article
我是rails的新手,想在form字段上应用验证。myviewsnew.html.erb.....模拟.rbclassSimulation{:in=>1..25,:message=>'Therowmustbebetween1and25'}end模拟Controller.rbclassSimulationsController我想检查模型类中row字段的整数范围,如果不在范围内则返回错误信息。我可以检查上面代码的范围,但无法返回错误消息提前致谢 最佳答案 关键是您使用的是模型表单,一种显示ActiveRecord模型实例属性的表单。c
我正在使用Rails构建一个简单的聊天应用程序。当用户输入url时,我希望将其输出为html链接(即“url”)。我想知道在Ruby中是否有任何库或众所周知的方法可以做到这一点。如果没有,我有一些不错的正则表达式示例代码可以使用... 最佳答案 查看auto_linkRails提供的辅助方法。这会将所有URL和电子邮件地址变成可点击的链接(htmlanchor标记)。这是文档中的代码示例。auto_link("Gotohttp://www.rubyonrails.organdsayhellotodavid@loudthinking.
查看我的Ruby代码:h=Hash.new([])h[0]=:word1h[1]=h[1]输出是:Hash={0=>:word1,1=>[:word2,:word3],2=>[:word2,:word3]}我希望有Hash={0=>:word1,1=>[:word2],2=>[:word3]}为什么要附加第二个哈希元素(数组)?如何将新数组元素附加到第三个哈希元素? 最佳答案 如果您提供单个值作为Hash.new的参数(例如Hash.new([]),完全相同的对象将用作每个缺失键的默认值。这就是您所拥有的,那是你不想要的。您可以改用