小编Sea*_*ean的帖子

加载大量图像的最佳方式

我创建了一个基本的 html 网站,它有一个带有图像的画廊。它根据拍摄的月份存储它们。所有图像的页面加载速度都很慢,是否有更好的方法来存储图像以使其加载速度更快?

谢谢

html css image

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

如何将alt文本添加到背景图像?使背景图像可访问

我有一个网站,它将许多图像显示为背景图像,使用background-size: cover它们的大小来完全填充元素,同时裁剪掉不适合的图像的任何部分.

问题是这些图像不是纯粹的装饰.它们是页面信息内容的重要组成部分.这意味着他们需要alt文本才能被屏幕阅读器和其他辅助技术访问.

alt向背景图像添加描述的最具语义的方法是什么?

article {
  position: relative;
  width: 320px;
  margin: 5rem auto;
}

figure {
  width: 100%;
  height: 180px;
  /* not accessible */
  background-image: url('http://www.fillmurray.com/300/300');
  background-size: cover;
  background-position: center;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<article class="panel panel-default">
  <header class="panel-heading">
    <h4 class="panel-title">Title of Article</h4>
  </header>
  <div class="panel-body">
    <figure class="article-image"></figure>
  </div>
  <footer class="panel-footer">
    <a class="btn btn-default" href="#">Read</a>
  </footer>
</article>
Run Code Online (Sandbox Code Playgroud)

html css accessibility

1
推荐指数
2
解决办法
4306
查看次数

我怎么能干这个css规则

有没有办法在仅使用一个.active选择器的情况下编写与以下内容等效的规则集?

.active #pselect,
.active #bselect,
.active #cselect,
.active #nselect,
.active #iselect {
    color: white;
}
Run Code Online (Sandbox Code Playgroud)

css

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

如何使用json/jquery中的数据创建表?

我想创建一个包含json数据的表,我应该修改我的jquery代码,以便能够创建包含数据或其他内容的行(仅修改我的json,css?...)

我需要使用我的数据水平创建一个表,此时我的<th>标签显示为内联,css为行,但使用json导入的数据垂直放在一列中.

jQuery的:

$(document).ready(function() {
    $.ajax({
        url: 'weather.json',
        type: 'GET',
        dataType: 'json', // Returns JSON
        success: function(response) {
            var sTxt = '';
            $.each(response, function(index, weatherElement) {
                sTxt += '<tr><td>' +  weatherElement.city+'</td></tr>';
                sTxt += '<tr><td>' +  weatherElement.current_condition+'</td></tr>';
                sTxt += '<tr><td>' +  weatherElement.temperature+'</td></tr>';
                sTxt += '<tr><td>' +  weatherElement.wind_speed+'</td></tr>';
                sTxt += '<tr><td>' +  weatherElement.wind_direction+'</td></tr>';
                sTxt += '<tr><td>' +  weatherElement.wind_chill_factor+'</td></tr>';
            });
            $('#weatherlist').append(sTxt);
        },
        error: function() {
            $('#info').html('<p>An error has occurred</p>');
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

HTML:

    <!DOCTYPE html>
    <html>

    <head>
        <title>Ajax and json Data</title> …
Run Code Online (Sandbox Code Playgroud)

html css jquery json

0
推荐指数
1
解决办法
1028
查看次数

Gulp: /usr/local/bin/gulp: 没有那个文件或目录

每当我运行 gulp 时,都会出现以下错误:

/usr/local/bin/gulp: 没有那个文件或目录

我遵循了关于 SO 的几个相关问题的答案,但没有一个解决了我的问题。几个月来我一直在使用 gulp 没有问题,但设法以某种方式把它搞砸了。

我已经在本地和全局删除了 gulp 和 gulp-cli(使用 npm)。

运行以下命令后:

npm install -g gulp-cli
npm install --save-dev gulp
Run Code Online (Sandbox Code Playgroud)

任何使用 gulp 的命令,甚至会gulp -v返回上面提到的错误。安装过程中没有错误。

我已经确认没有任何东西/usr/local/bin/gulp,但是不应该重新安装东西来重新创建应该在那里的任何文件吗?

任何帮助表示赞赏。

编辑:

全局安装 gulpnpm install -g gulp并不能解决任何问题。

node.js npm gulp

0
推荐指数
1
解决办法
6997
查看次数

当列表中存在项目时,indexOf() 方法返回 -1

\r\n
\r\n
let mobile = [\n  "\xe2\x80\xad+9384849202",\n  "\xe2\x80\xad+5808789645",\n  "\xe2\x80\xad+0989645643",\n  "\xe2\x80\xad+7864769845",\n]\n\nconsole.log(mobile.indexOf("+7864769845"))
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n

其结果是-1当预期结果是3

\n

起初以为是类型错误,但现在不确定?

\n

javascript indexing

0
推荐指数
1
解决办法
135
查看次数

标签 统计

css ×4

html ×3

accessibility ×1

gulp ×1

image ×1

indexing ×1

javascript ×1

jquery ×1

json ×1

node.js ×1

npm ×1