我不太喜欢那些提供一些标准但没有推理出可接受的解决方案的问题,但在这种情况下,我也有一个问题:没有 JavaScript 的兼容性,除了 Modernizr。 . (原因是他们放慢了页面速度。)
我使用了新奇的 CSS3 flexbox 来创建一个菜单,如果有一些额外的空间,它会显示一些额外的链接。您可以看到一个(希望)工作演示 here .
最大的问题是:如何在不使用有点著名的 FlexieJS 的情况下为(咳嗽)烦人(/咳嗽)的 Internet Explorer 和旧浏览器提供回退。图书馆?除了为菜单 (ul) 设置最大百分比宽度(实际上不起作用)之外,仅使用 css2 是否可以实现这一点?你能至少指出我正确的方向吗?谢谢!
我又试了一次,但仍然无法自行解决。非常感谢任何帮助!非常感谢 =) 你可以找到我的尝试 here .
最佳答案
我知道这是一个旧线程,但我认为它应该对您的要求做出适当的回答。由于您使用的是 Modernizr,我们可以默认为 inline-block,但会检测 flexbox 何时可用并覆盖(使用 good ol',或 good new,progressive enhancement)。为了让它工作,你需要切换 #admin-links 和 #common-links。下面是代码,它适用于 IE6+。 demo也可用。
<div id="wrapper">
<div id="navigation">
<ul id="admin-links">
<li>
<a href="#">Important Link</a>
</li>
<li>
<a href="#">Important Link</a>
</li>
</ul>
<ul id="common-links">
<li>
<a href="#">Important Link</a>
</li>
<li>
<a href="#">Important Link</a>
</li>
<li>
<a class="omittable" href="#">Omittable Link</a>
</li>
<li>
<a class="omittable" href="#">Omittable Link</a>
</li>
<li>
<a class="omittable" href="#">Omittable Link</a>
</li>
</ul>
</div>
<div id="content">
<p>Hello world.</p>
<p>This is supposed to be content.
But only thing we care is the menu (Sorry about that.)
</p>
<p>Page width decreases, some items magically disappear.<br />
Which is <strong>intended</strong>.<br />
You can do that by pulling the frame bars around.
</p>
</div>
</div>
#wrapper {
background: #eee;
width: 100%;
min-width: 450px;
max-width: 700px;
margin: 0 auto;
}
#navigation {
height: 40px;
background: #f00;
width: 100%;
overflow: hidden;
}
.flexbox #navigation {
-moz-box-align: stretch;
-moz-box-orient: horizontal;
-webkit-box-align: stretch;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-box-orient: horizontal;
-ms-box-orient: horizontal;
box-orient: horizontal;
-moz-box-align: stretch;
-webkit-box-align: stretch;
-ms-box-align: stretch;
box-align: stretch;
-moz-box-direction: reverse;
-webkit-box-direction: reverse;
-ms-box-direction: reverse;
box-direction: reverse;
display: -moz-box;
display: -webkit-box;
display: -ms-box;
display: box;
float: none;
}
#navigation ul {
overflow: hidden;
z-index: 990; letter-spacing: -4px;
}
#common-links {
overflow: hidden;
}
.flexbox #common-links {
-moz-box-flex: 1;
-webkit-box-flex: 1;
-ms-box-flex: 1;
box-flex: 1;
}
#navigation li {
display: inline-block;
letter-spacing: normal; height: 40px;
}
#navigation li a {
padding: 10px;
display:inline-block;
*display: inline;
zoom: 1;
background: #0c0;
outline: solid 1px #0c0;
}
#navigation a.omittable {
background: #0f0;
}
#admin-links {
float: right;
}
.flexbox #admin-links {
float: none;
}
#admin-links ul {
white-space: nowrap;
}
关于html - 为创造性地使用 "Flex-Box"而回退到旧的(和烦人的)浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5952779/
我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar
在我的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并在看到包时选择
我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test
我正在尝试从Postgresql表(table1)中获取数据,该表由另一个相关表(property)的字段(table2)过滤。在纯SQL中,我会这样编写查询:SELECT*FROMtable1JOINtable2USING(table2_id)WHEREtable2.propertyLIKE'query%'这工作正常:scope:my_scope,->(query){includes(:table2).where("table2.property":query)}但我真正需要的是使用LIKE运算符进行过滤,而不是严格相等。然而,这是行不通的:scope:my_scope,->(que
我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file
当我尝试安装Ruby时遇到此错误。我试过查看this和this但无济于事➜~brewinstallrubyWarning:YouareusingOSX10.12.Wedonotprovidesupportforthispre-releaseversion.Youmayencounterbuildfailuresorotherbreakages.Pleasecreatepull-requestsinsteadoffilingissues.==>Installingdependenciesforruby:readline,libyaml,makedepend==>Installingrub