gpt4 book ai didi

javascript - 显示 :none or visibility:hidden on body element on page load - does it affect SEO?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:35:58 25 4
gpt4 key购买 nike

我正在构建一个网页,我会做一些 JS 计算和样式来制作精美的东西。但是,我坚持 FOUC .首先我调用所需的样式,然后根据 JS 计算更改 div 上的一些填充和边距。这会导致某种页面闪烁。为了忽略这一点,我想将 display:nonevisibility:hidden 设置为 body 元素,直到计算完成,然后显示页面.

HTML

<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<!-- These meta tags come first. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Theme Example</title>

<!-- Bootstrap -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/styles.css" rel="stylesheet">

<script src="assets/js/modernizr-custom.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$('body').hide();
// ... do calculations and styling ...
$('body').show();
</script>
</head>

这会影响 SEO 吗?还有其他解决该问题的方法吗?

最佳答案

只要您没有隐藏关键字或使用内容发送垃圾邮件,就应该没有问题。

有关更多信息,您可以在 Google Webmaster Central 上查看此主题。论坛:

"Merely using display:none will not automatically trigger a penalty. The key is whether or not there is a mechanism - either automatic or one that is invoked by the user - to make the content visible.Google is becoming very adept at processing JavaScript to find and interpret such mechanisms.If you use valid HTML, CSS, and JavaScript you have nothing to worry about. Good luck!"

希望这对您有所帮助。

关于javascript - 显示 :none or visibility:hidden on body element on page load - does it affect SEO?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39942850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com