相关疑难解决方法(0)

html堆栈顺序

请考虑以下代码:

<!DOCTYPE html>
<html lang="en">

<head>
  <title>HTML</title>
  <meta charset="utf-8" />

  <style type="text/css">

    h1 {
      font-size: 2em;
      font-family: Verdana;
      font-weight: bold;
    }

    p {
      border: 3px solid blue;
      margin-top: -50px;
      background-color: green;
      color: white;
    }

  </style>

</head>

<body>

  <h1>QUESTION</h1>
  <p>The header text in the preceding h1 element is behind this
    paragraph's text (as expected), but on top of this paragraph's
    background and border (not expected).
  </p> 

</body>

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

请参阅此处的示例:http://jsfiddle.net/ZKHc9/

为什么段落的背景和边框不像内容那样呈现在标题的顶部?

html css stack

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

标签 统计

css ×1

html ×1

stack ×1