- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想要一个用于广告的顶部“托盘”。它可以使用 javascript 脚本滑出页面边界。它下方的“分隔线”包含关闭图标,主要是装饰性的,因为当页面滚动超过一个点时它会固定。 (这是为了防止浏览器的主题搞砸页面设计)。
我的问题是在分隔符通过 javascript 获取 position:fixed
之前,它需要是 position:relative
或 position:static
,因为绝对定位会将其从页面流中移除。当我将它设置为 position:static
和 width:100%
时,有一个边距可以通过它显示背景图像。我希望它覆盖整个页面顶部。我已经搜索了解决方案,但找不到有关如何删除此边框的任何信息。使用 jsfiddle 更容易解释:顶部有红色边框的部分,当您向下滚动时,它正下方有一个分隔线固定到页面。我不知道如何让红色边框和分隔线(在它固定之前)跨越页面的宽度。
这是有问题的 HTML 片段:
<div class = "adTray">
<div class = "ad"></div>
<div class = "ad"></div>
</div>
<div class="topBorder"></div>
还有 CSS:
.adTray{
border: 1px solid red;
height:100px;
width:100%;
}
#topBorderScrolled{
position:fixed;
z-index:100;
}
.topBorder{
right:0;
left:0;
top:0;
background: rgb(68,68,68); /* Old browsers */
background: -moz-linear-gradient(top, rgba(68,68,68,1) 0%, rgba(51,51,51,1) 50%, rgba(38,38,38,1) 50%, rgba(20,20,20,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(68,68,68,1)), color-stop(50%,rgba(51,51,51,1)), color-stop(50%,rgba(38,38,38,1)), color-stop(100%,rgba(20,20,20,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(68,68,68,1) 0%,rgba(51,51,51,1) 50%,rgba(38,38,38,1) 50%,rgba(20,20,20,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(68,68,68,1) 0%,rgba(51,51,51,1) 50%,rgba(38,38,38,1) 50%,rgba(20,20,20,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(68,68,68,1) 0%,rgba(51,51,51,1) 50%,rgba(38,38,38,1) 50%,rgba(20,20,20,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(68,68,68,1) 0%,rgba(51,51,51,1) 50%,rgba(38,38,38,1) 50%,rgba(20,20,20,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#141414',GradientType=0 ); /* IE6-9 */
width:100%;
height:15px;
border:1px solid #111111;
}
我希望所有这些都有意义。
最佳答案
使用 reset.css 规范化所有样式,阅读此处可用的重置 CSS 之一:http://meyerweb.com/eric/tools/css/reset/ .
另一种快速的方法是将 body 上的边距设置为零,例如。 body {margin: 0}
但推荐的方法是使用 reset.css。
关于html - 建仓 :static (or :relative) element span the width of the page,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23704684/
我想了解这两者的区别 谢谢 最大宽度:100px 宽度:100px body{ max-width: 1080px; width: 1080px; backgrou
jQuery 的 .width()、jQuery 的 .css('width') 和 .style 返回的值有什么区别.width 节点上的属性? 我很好奇,因为在尝试将两个表格单元格的宽度设置为相等
我可以在 wordpress 的 header php 中添加两个视口(viewport): 和 我希望能够使用 viewport width 1024 显示everything,除非您是低于 x
好的,所以我得到了 ImageBackground 的以下组件(使用 typescript ,但应该是不言自明的)。 (这是 react 原生的) import * as React from "re
我正在尝试根据 div 中包含的图像的宽度调整其大小,但没有任何 JS 方法可以一致地工作来获取图像的宽度。 label here img { width: auto
我有一个表,我试图找到表中每个 td 的宽度。我尝试了各种变体:$("td")[0].width(),但它们都不起作用,收到错误:"Uncaught TypeError: $ (...)[0].wid
我在使 rem 中的 min-width 与百分比宽度共存时遇到了一些问题。 When resizing this jsfiddle the outer right block is going un
当我在 chrome(以及 Edge/Brave/Opera)的设备模式下测试页面时,设备宽度属性似乎减少了,但宽度属性没有 重新创建: html {
我想依次显示 div #botone、#bottwo 和 #bottree。我还希望在 #botone div 上按 100% 宽度和比例高度调整背景图像。 现在最后两个 Div 显示在 #boton
我是第一次学习 JavaScript 的学生,我有一个学校问题,我们需要指出 width 和 style.width 接受的数据类型。 我知道数据类型有数字、字符串、空值、未定义、 bool 值和对象
所以看起来在移动设备中媒体查询使用 screen.width 根本没有改变。但是在我的桌面上,当我更改窗口大小时,screen.width 保持不变,$(window).width() 发生变化,并且
http://jsfiddle.net/3BFGU/27/ 有谁知道为什么包含文本“ABC”的跨度的宽度返回 0。 1) 仅在 Firefox 中发生。2)如果我删除两者之间的跨度,它工作正常。 (h
我知道下面的代码清除了 Canvas canvas.width = canvas.width 但这在内部是如何工作的呢? 赋值运算符只是将一些值赋给变量,但是上面的代码如何清除 Canvas ? 根据
当使用 max-width 时,为什么它不会“破坏”超过允许长度的单词,我该如何让它工作? JSFiddle function input() { var inputText = document
在移动网站上,在利用 width=device-width 视口(viewport)设置的同时调整文本大小的最佳方式是什么? 最佳答案 样式百分比如何?比如 100% 或 90%。 关于html -
对于我的 WPF Toolkit DataGrid,我使用以下自定义列标题样式:
过去,我看到下一个 css,我在想两者之间是否存在一些实际差异 min-width: 90px; max-width: 90px; 和 width: 90px; 最佳答案 使用 width 将简单地在
我有一个 R Markdown,我从 RStudio 中将其编织为 html。我可以使用 fig.width 和 fig.height 来调整我的绘图的分辨率,但我似乎无法加宽页面输出,以便文本输出不
此处的示例代码:http://pastebin.com/95z3pftQ 我正在尝试构建一个带有固定标题和“内容”部分的移动页面,该部分将填充外部(经过清理,但在其他方面是任意的)HTML。我需要使用
这里是 dp 单位的定义:(如果它是正确的...) 密度无关像素 - 一种基于屏幕物理密度的抽象单位。这些单位是相对于 160 dpi 屏幕而言的,因此 1 dp 是 160 dpi 屏幕上的一个像素
我是一名优秀的程序员,十分优秀!