小编weB*_*Ber的帖子

边框样式不适用于粘性位置元素

我不知道为什么我的边框样式不适用于position: sticky;属性.我想在我的粘性表头上设置边框样式.但我不想使用透明的背景色.我怎样才能实现它?以下是我的问题和JSFiddle链接的示例代码

#wrapper {
  width: 400px;
  height: 200px;
  overflow: auto;
}

table {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
}

table tr th,
table tr td {
  border: 2px solid;
}

table thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  background-color: #edecec;
}
Run Code Online (Sandbox Code Playgroud)
<div id="wrapper">
  <table>
    <thead>
      <tr>
        <th>A</th>
        <th>B</th>
        <th>C</th>
        <th>D</th>
        <th>E</th>
      </tr>
    </thead>
    <tr>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
    </tr>
    <tr>
      <td>2</td>
      <td>2</td>
      <td>2</td>
      <td>2</td>
      <td>2</td>
    </tr>
    <tr>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td> …
Run Code Online (Sandbox Code Playgroud)

html css

20
推荐指数
6
解决办法
8592
查看次数

<object> PDF不能在移动设备上滚动

object在html中有一个标记位置,如下所示:

<div class="viewport" id="pdf-viewport">
   <object class="pdf-object" data="PDF_URL_HERE" type="application/pdf"></object>
</div>
Run Code Online (Sandbox Code Playgroud)

我的桌面上的观看体验还可以,但我无法在移动设备上滚动pdf.如何添加此功能?我试过CSS和溢出但我想我错过了什么.

编辑 我尝试使用GoogleDocs/GoogleDrive在iFrame中嵌入pdf,但它给了我Preview not available太多次,所以它不可靠.

html javascript css pdf

14
推荐指数
1
解决办法
2626
查看次数

使用`column-count`和`box-shadow`,CSS Masonry UI无法正常工作

下面是我的Masonry UI代码,我使用的是纯CSS

如果有超过4张牌,这种方法效果很好,但如果我使用4张以下的,column-count: 3;则效果不佳.

body{
  height:1000px;
}

ul {
    list-style: none;
    -moz-column-count: 3;
    -webkit-column-count: 3;
    column-count: 3;
    -moz-column-gap: 1em;
    -webkit-column-gap: 1em;
    column-gap: 1em;
    padding: 0px 4px 4px 4px;
    margin-top: -10px;
    display: inline-block;
    width: 100%;
    margin: 0px;
    
}

li {
    width: 100%;
    display: inline-block;
    box-shadow: none;
    background: transparent;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    margin: 2%;
}

li div {
    border-radius: 3px;
    background-color: #f4faff;
    box-shadow: 0px 0px 4px rgba(0, 0, …
Run Code Online (Sandbox Code Playgroud)

html css html5 css3

13
推荐指数
1
解决办法
341
查看次数

SVG` <path>`javascript动画无法按预期工作

我取得了什么:

// Get the id of the <path> element and the length of <path>
var myline = document.getElementById("myline");
var length = myline.getTotalLength();
circle = document.getElementById("circle");
// The start position of the drawing
myline.style.strokeDasharray = length;

// Hide the triangle by offsetting dash. Remove this line to show the triangle before scroll draw
myline.style.strokeDashoffset = length;

// Find scroll percentage on scroll (using cross-browser properties), and offset dash same amount as percentage scrolled
window.addEventListener("scroll", myFunction);

function myFunction() {
  // What % …
Run Code Online (Sandbox Code Playgroud)

javascript css html5 svg css3

13
推荐指数
2
解决办法
554
查看次数

仅使用CSS设置"调用活动"动画

我想要一个我Call active animation的项目.我创建了一个,但对动画并不是100%满意.我在这里粘贴我的代码请帮我创建一个很好的调用活动动画.如果你们有任何其他动画建议,请开火.干杯.!

我想要的是表示用户正在与另一个人交谈的动画.

.rc_side_phone {
  display: inline-block;
  font-size: 34px;
  width: 38px;
  height: 40px;
  background: rgba(94, 178, 2, 0.56);
  color: #fff;
  line-height: 40px;
  border-radius: 7px;
  background: #4CAF50;
  margin-left: 11px;
  margin-top: 8px;
}

.rc_side_phone i {
  line-height: 45px;
  margin-left: 4px;
}

.rc_side_phone:after {
  position: absolute;
  content: '';
  border-right: 2px solid #ffffff;
  width: 10px;
  left: 34px;
  top: 28px;
  height: 12px;
  border-radius: 50%;
  z-index: 9;
  transform: rotate(-44deg);
  -webkit-transform: rotate(-44deg);
  animation: onCall 1s steps(5) infinite;
  -webkit-animation: onCall 1s steps(5) …
Run Code Online (Sandbox Code Playgroud)

css user-interface animation css3 css-transitions

11
推荐指数
2
解决办法
1407
查看次数

在绝对定位的元素上遇到nowrap和max-width问题

我猜这两个属性实际上并没有合作,但我的情况是:

我正在尝试创建一个工具提示组件.我的工具提示绝对定位,因为我不知道内容的长度是多少,没有宽度.因此,与宽度相关的CSS,文本只是形成一个高,瘦的列.我试过了max-width,但就它本身而言,它什么也没做.所以我决定尝试white-space: nowrap,虽然它很好地不包装文本,但它似乎也没有以有用的方式遵循最大宽度,而文本反而超出了元素的边界.

如果有一个干净的解决方案,我想不出如何解决我的问题.我希望有一个绝对定位的div扩展到适合它的内容,直到最大值,此时它包装.我看到的一个建议是将元素设置为弹性框,但据我所知,这对于IE来说不是很好,所以我认为在我的情况下是不可行的.有什么建议?

.wrapper {
  position: relative;
  display: inline;
}

.info {
  position: absolute;
  bottom: 1.2em;
  left: 0;
}
Run Code Online (Sandbox Code Playgroud)
<div class="wrapper">
  <span>[ ? ]</span>
  <div class="info">Any long text can go in here to test what goes wrong with wrapping.</div>
</div>
Run Code Online (Sandbox Code Playgroud)

css css-position tooltip css3 word-wrap

11
推荐指数
2
解决办法
3612
查看次数

.on('click'和.off('click').on('click'之间的区别

.off结合的用途或不同之处是.click什么?

$('#link').off('click').on('click',function(){});
Run Code Online (Sandbox Code Playgroud)

VS

$('#link').on('click',function(){});
Run Code Online (Sandbox Code Playgroud)

结合它们有什么好处?

jquery click onclick

9
推荐指数
1
解决办法
1万
查看次数

付款请求按钮的自定义主题[条纹]

通常,我们使用theme提供的条带,如下所示.

style: {
  paymentRequestButton: {
    theme: "light-outline"
  }
}
Run Code Online (Sandbox Code Playgroud)

他们还提供了一些主题 'dark' | 'light' | 'light-outline'

我的问题是我们可以为这个按钮创建一个自定义主题.例如:蓝色主题

或者是否有任何变通方法或脚本黑客用于更改按钮的颜色.

javascript css jquery stripe-payments stripe.js

9
推荐指数
2
解决办法
2742
查看次数

当从div中删除字符时,光标移动到contenteditable div的末尾

我正在创建自己的聊天应用程序,其中我使用内容可编辑div为聊天框.我正在实现提及功能,其中我提到的用户名包裹在span标签后跟一个空格(&nbsp;)但我的问题是当我删除空格时我的光标移动到div的末尾.

与空间

<html>

<head>
</head>

<body>
  <div contenteditable=true><span contenteditable='false'>UserName</span>&nbsp;</div>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

没有空间

<html>

<head>
</head>

<body>
  <div contenteditable=true><span contenteditable='false'>UserName</span></div>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

这就是我在代码中实现的方式,而且这个bug只发生在chrome中.

html javascript css html5 contenteditable

9
推荐指数
2
解决办法
654
查看次数

仅为最后一页修复了PRINT粘滞页脚

我所拥有的是<table>它有时可能只在一个页面上,有时它可能会增长到10页左右.

这是一个示例代码:

div{
  position:relative;
  height:100vh;
}

.table-blue{
  width:100%;
  background:lightblue;
}

.table-blue td{
  padding:5px 10px;
}

.table-blue-fotter{
    position: absolute;
    bottom: 20px;/* for bottom gap */
    left: 0px;
    width:100%;
    background:gray;
}


@media print {
 .table-blue-fotter{
    position: fixed;
    bottom: 20px;
    left:0px;
    width:100%;
    background:gray;
}
Run Code Online (Sandbox Code Playgroud)
<div>
<table class="table-blue">
  <tr>
    <td>one</td>
    <td>one test</td>
  </tr>
  <tr>
    <td>two</td>
    <td>two test</td>
  </tr>
  <tr>
    <td>three</td>
    <td>three test</td>
  </tr>
</table>

<table class="table-blue-fotter">
  <tr>
    <td>one</td>
    <td>one test</td>
    <td>one test</td>
  </tr>
  <tr>
    <td>two</td>
    <td>two test</td>
    <td>one …
Run Code Online (Sandbox Code Playgroud)

css printing html-table stylesheet css3

7
推荐指数
2
解决办法
3098
查看次数