gpt4 book ai didi

html - HTML 的 CSS 只出现在 Chrome 而不是 MS edge 或 IE

转载 作者:行者123 更新时间:2023-11-28 03:35:36 26 4
gpt4 key购买 nike

我想知道是否有人能回答为什么我的 HTML 文件的 CSS 仅在 Google Chrome 中显示为格式化,但在 Microsoft Edge 或 Internet Explorer 中显示为未格式化。第一次在这里发帖,所以非常感谢反馈。

这是我的 CSS,然后是我的 HTML:

html {
margin: 0;
padding: 0;
background-color: #777;
}
body {
width: 70%;
margin: 0 auto;
font: 100% Arial, Helvetica, sans-serif;
padding: 1em 50px;
background: white;
border-bottom: 10px solid gold;
}
h1 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 2em;
font-weight: normal;
font-style: italic;
margin: 0 0 .4em;
color: #ddd;
background-color: rgb(44, 45, 140);
padding: 5px 10px;
}
p {
line-height: 1.6;
text-align: justify;
width: 60%;
margin: 0;
margin-bottom: 1em;
}
a {
text-decoration: none;
color: red;
}
a:hover {
color: black;
}

//And here's my HTMl
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>External styles</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>HTML and CSS</h1>
<p><a href="page2.htm" title="page two">Page 2</a></p>
<p>One way to visualize how HTML and CSS work together is to think about a new building under construction. As the building goes up, the structure of the building is built first. At just the structural level, all you see is the frame of the new building, and other than the basic shape, you don&rsquo;t really know how the building is going to look. Once the frame is complete, the &ldquo;skin&rdquo; of the building is added. This could be brick, wood, glass, stucco, or any number of outer materials that determine what the final look of the building will be.</p>
<p>HTML and CSS work much the same way. HTML gives us the structure, or &ldquo;frame&rdquo;, of our pages. We can use CSS to then control how this structure looks, where elements are positioned, and add additional decorative styling. What&rsquo;s more, much the same way a building can change dramatically by adding a new façade; web pages can change their visual design by simply changing the page&rsquo;s CSS.</p>
<p>This separation of structure and presentation creates a very flexible and efficient workflow where the structure of pages is independent of how the pages are presented. This allows you to update styling without changing page content, and provide different visual designs based on the context of where the page is being displayed.</p>
</body>
</html>

最佳答案

如果你的结构元素

    • index.html
    • 样式.css

如果你包含 style.css,

<link href="style.css"/>

但是如果你的结构元素

    • index.html
    • Assets
      • 样式.css

你可以包含 location style.css

<link href="assets/style.css"/>

关于html - HTML 的 CSS 只出现在 Chrome 而不是 MS edge 或 IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44498575/

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