首页 > 解决方案 > 自动保存时页面闪烁/闪烁(仅在 CSS 文件上)

问题描述

我刚从 Atom 切换到 VsCode,我遇到了这个问题。

我正在编写一个测验测试,因为我正在练习 JS,我发现每次我在 CSS(字符、空格)中输入一些东西时,我都会在很短的时间内看到网页的内容在 HTML 的默认位置(所以,左对齐)。

这很烦人。这只发生在 CSS 上,而不是 HTML 或 JS。

我在这里查看了问题,但至少从我所看到的来看,他们都没有遇到我遇到的确切问题。

在这里我添加了一些照片。第一个没问题,应该是这样,但是在第二个中,当我输入一些随机空格时,它很快就失去了所有的样式。

第一张图片 - 正常行为

第二张图片 - 奇怪的行为.

对于那 1000 秒,CSS 停止工作,每次我按下关键字按钮时它都会停止工作。让你头晕目眩。

这里的代码,也许我做错了什么(?)

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: helvetica;
}

.title {
  text-align: center;
}

.title ~ h3 {
  text-align: center;
  margin-top: 20px;
  color: green;
  font-size: 1.8em;
}

.questions {
  text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="style.css">
  <title>Document</title>
</head>
<body>
  
  <div class="quizCont">
    <div class="title">
      <h1>Welcome to the most exciting quiz</h1>
      <h3>Are you ready to test your abilities?</h3>
    </div>
      <h3>Here we go!</h3>
    </div><br><br>

    <div class="questions">

      <div class="question1">
        <h3>1. What is the capital of the United States?</h3>
        <p>a. New York</p>
        <p class="quest1">b. Washington D.C.</p>
        <p>c. Texas</p>
      </div><br><br>

      <div class="question2">
        <h3>2. When was Google invented?</h3>
        <p>a. 1980</p>
        <p>b. 2000</p>
        <p class="quest2">c. 1996</p>
      </div><br><br>

      <div class="question3">
        <h3>3. What was the year the man walked on the Moon?</h3>
        <p class="quest3">a. 1969</p>
        <p>b. 1920</p>
        <p>c. 2009</p>
      </div>
    </div>

  </div>

<script src="main.js">


</script>
</body>
</html>

标签: javascripthtmlcss

解决方案


推荐阅读