- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用内部有 ul 列表的自定义滚动条。当 ul 列表或 li 内容扩展时,滚动条也会扩展。
我在主 div 中使用了 white-space:nowrap 以便 ul 宽度得到扩展,但它仅在 chrome 中有效,但在 firefox/IE 和其他浏览器中无效。
这是我的代码
<div class="horizontalaccordion">
<ul>
<li>
<h3>Heading 2</h3>
<div>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</li>
<li>
<h3>Heading 3</h3>
<div>Content For Panel 3.</div>
</li>
<li>
<h3>Heading 4</h3>
<div>Content For Panel 4</div>
</li>
<li>
<h3>Heading 1</h3>
<div>Content For Panel 1.</div>
</li>
<h3>Heading 3</h3>
<div>Content For Panel 3.</div>
</li>
<li>
<h3>Heading 2</h3>
<div>Content For Panel 2.</div>
</li>
<li>
<h3>test</h3>
<div>Content For Panel sow</div>
</li>
<li>
<h3>Heading 3</h3>
<div>Content For Panel 3.</div>
</li>
<li>
<h3>Heading 4</h3>
<div>Content For Panel 4</div>
</li>
</ul>
</div>
CSS
.horizontalaccordion{
height:auto; width:auto; white-space:nowrap; border-radius:4px !important; background-color: #b6b6b6; margin-right:15px ; height:95px; overflow:hidden
}
.horizontalaccordion>ul {
margin: 0;
padding-left:0;
list-style:none;
height: 95px ; width:auto; display:inline-block
}
.horizontalaccordion>ul>li {
display:block;
overflow: hidden;
float:left;
margin: 0 !important;
padding: 0 !important;
list-style:none;
width:38px;
height: 95px;
/* CSS3 Transitions */
transition: width 0.1s ease-in-out;
-moz-transition: width 0.1s ease-in-out;
-webkit-transition: width 0.1s ease-in-out;
-o-transition: width 0.1s ease-in-out;
}
.horizontalaccordion>ul>li>h3 {
display:block;
margin: 5px 0 0 0;
padding:10px;
height:65px;
width:72px;
border-radius:6px;
box-shadow: 0px -2px 2px #616161;
/* Decorative CSS */
font-family: Arial, Helvetica, sans-serif;
text-decoration:none;
text-transform:uppercase;
color: #000;
background-color: #B3B3B3;
background: -webkit-gradient(linear, 0% 0%, 0% 95%, from(#BEBEBE), to(#B3B3B3));
background: -moz-linear-gradient(top, #BEBEBE 0%, #B3B3B3 95%);
font:bold 12px Myriad Pro, Verdana, Geneva, sans-serif; color:#2c3e52;
/* CSS3 Transform Rotate & Translate */
white-space:nowrap;
-moz-transform: rotate(-90.0deg); /* FF3.5+ */
-o-transform: rotate(-90.0deg); /* Opera 10.5 */
-webkit-transform: rotate(-90.0deg); /* Saf3.1+, Chrome */
transform: rotate(-90.0deg); /* Saf3.1+, Chrome */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3.0)
progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff999999, endColorstr=#ffcccccc); /* IE6,IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3.0)"
"progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff999999, endColorstr=#ffcccccc)"; /* IE8 */
}
.horizontalaccordion>ul>li>div {
display:none;
float:left;
overflow: auto;
position:relative;
top:-88px;
left:40px;
*top:0px; /* IE7 Hack */
*left:0px; /* IE7 Hack */
margin:0;
width:auto;
height:68px;
padding:10px 50px 10px 10px; white-space:nowrap;
background:#f0f0f0; color:#000;
border-radius:4px;
-webkit-box-shadow: inset 0px 2px 2px #9b9b9b; box-shadow: inset 0px 2px 2px #9b9b9b;
}
.horizontalaccordion>ul>li.hover {
overflow: hidden;
width: auto;
}
.horizontalaccordion>ul>li.hover>div {
display:block;
}
horizontalaccordion>ul>li.hover>h3 {
/* Decorative CSS */
color:#fff;
background:#000000;
/* CSS3 Gradient Effect */
background: -moz-linear-gradient( top, #454545, #000000); /* FF, Flock */
background: -webkit-gradient(linear, left top, left bottom, from(#454545), to(#000000)); /* Safari, Chrome */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1.0)
progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff454545, endColorstr=#ff000000); /* IE 5.5 - IE 7 */
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1.0)"
"progid:DXImageTransform.Microsoft.gradient(startColorstr=#ff454545, endColorstr=#ff000000)"; /* IE 8 */
}
.horizontalaccordion>ul>li>h3:hover {
cursor:pointer;
/* Decorative CSS */
}
最佳答案
I set up your code on a JS Fiddle尝试更好地理解问题。
一些事情:
<li>
标签,这可能会破坏东西。white-space:nowrap
style 规则旨在防止 text 换行(参见 here ),(它在我链接到的 Fiddle 中成功地做到了这一点),但它对防止元素换行没有任何作用。
也许你想要的是移除
whitespace: nowrap
并使用其中之一:
overflow-x: visible; /* shows all items even if the area is too small */
overflow-x: scroll; /* Will always show a scrollbar */
overflow-x: auto; /* Will only show a scrollbar when the content doesn't fit */
overflow-x: hidden; /* Content will just drop off the end of the page */
希望对您有所帮助。如果您能准确说明您希望的是什么,那就太好了。在 JSFiddle 上,您可以更改内容、更新它并发布链接(如果它可以帮助我们准确地了解您正在寻找的内容)。
关于css - Firefox 中的空白 nowrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12137789/
我现在是我的 div 的宽度,但我不知道我的 child button 和 ins 标签的高度。ins标签有nowrap。 我想用 ins 标签在一行中显示 button。 div { bor
我有一个 KnockoutJS 模板,它创建一个 input[type=text] 和一个 select 彼此相邻,没有 中间。然而,它在 white-space: nowrap; 之间设置了一个换行
所以我有这些 DIV,我已安排它们在父级内部向左向右滑动。 请参阅以下 JSFiddle 以查看设计: http://jsfiddle.net/StevP/C9WL7/ 您可以看到,通过将第一个子 D
在此图像中,最后一个框中有额外的空间,如红色箭头所示。如何解决? 最后一个短语周围有 white-space: nowrap。 JSFiddle .outer { text-align: cent
我想制作一些带有分隔线的自定义标题。我将最大宽度文本设置为 40%,行分隔符显示在文本之后。主要想法是,如果文本少于 40%,则行从文本结束处开始,但如果文本大于 40%,则换行。 不幸的是,如果我不
我正在尝试构建一个切换开关,单击它可以添加或删除空格换行。 必须包裹的div不能有ID,所以需要通过它的类来识别。在本例中为“文本”。在整个页面上,该类仅使用一次。 我构建了这个,但它不起作用。我哪里
我正在尝试使用 CSS 进行以下设计: 想法是让它在全 Angular 容器中水平滚动。 我在包装器中添加了 white-space: nowrap,但由于文本太长,它会从容器中消失。这是问题的屏幕截
使用 nowrap 和列表项会出现一些奇怪的行为。如何让填充在 chrome 中正确应用于“Testing 123”li? (测试 123 中的“3”超出了定义的宽度并侵占了填充)。 基本上我想要实现
不使用 table 可以将标签放在每个文本框上方吗?我的问题是当我尝试在“NoWrap”中放置“新行”时。 基本上我得到了一个数组的数组,有“名称”和“值”,值将由用户更改,所以第一组元素将并排显示,
我承认,当我不想让单词间断时(例如表格标题),我有在单词之间使用 的习惯。 我真的应该使用 white-space:nowrap 来设置我的元素样式吗?如果我唯一想做的就是避免换行,这两者有什么优
如果我有几个输入( radio 或选项)后跟它们的标签,都在同一行。我是如何做到的,这样它就不会在 radio 后断线,而是在标签后如果需要断线。 First radio Second radio T
在这种情况下: Some Text 我想在必要时在我的文本上换行,但我不希望我的跨度换行,我希望它始终坚持文本的一部分。我该怎么做? 谢谢, 最佳答案 我如何通过将一
有没有办法避免 div 的换行当内容不仅仅是文本时的内容,例如几个按钮? 最佳答案 white-space:nowrap; 应该可以解决问题。 #foo { white-space:nowrap;
这是我的代码中不起作用的部分: .copyright { display: flex; flex-wrap: nowrap; /* This is not working */ col
我想让标题包含 Logo 和菜单。 我做了一行和两列。我使用了 Bootstrap 类。当我将窗口大小调整为较小时,菜单会在 Logo 下跳转(看我的图片)。在屏幕宽度较小且菜单在 Logo 下跳转的
我有大量表格数据,其中最左边的列需要始终显示,并且每一行只占一行 - 这可以通过 CSS 指令 white-space: nowrap 来实现>. 我选择了DataTables jQuery plug
我有一个应该内联显示的链接列表。问题是我不希望文本在链接中间换行。如果它需要换行,它应该只在 链接之间进行换行。 因此,我已将 white-space:nowrap; 属性添加到我的链接中。但是生成的
我有一个设置 word-wrap:break-word 的问题。结果让这个div显示了scroll-x。但问题是 blockquote 元素不再是 break-word 的样式,它正在向正确的方向堆叠
这是 JSFIDDLE我想要制作 img 标签:margin-right:1px;但是当我设置空白:nowrap;我不能那样做。我该怎么办?? 最佳答案 试试这个 http://jsfiddle.ne
我正在使用内部有 ul 列表的自定义滚动条。当 ul 列表或 li 内容扩展时,滚动条也会扩展。 我在主 div 中使用了 white-space:nowrap 以便 ul 宽度得到扩展,但它仅在 c
我是一名优秀的程序员,十分优秀!