gpt4 book ai didi

html - CSS 在所有浏览器中都不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 23:25:48 25 4
gpt4 key购买 nike

我正在构建一个简单的网站,并发现虽然 CSS 在 Chrome(我通常使用它)中运行良好,但在 Firefox 或 IE 中却根本无法运行。就像它是一个带有图片和文字的空白页面,就像我没有写任何 CSS 一样。 HTML 加载正常,但很明显根本没有使用 CSS。

这是我所有的 HTML:

<!DOCTYPE HTML>

<html>

<head>
<title>Apple Tree House</title>
<link rel="stylesheet" type="css" href="stylesheet.css" />
<link rel="shortcut icon" href="root/icon.ico" type="image/ico" />

</head>
<body>

<div id="container">

<header>
<img src="root/logo.png" id="logo" width="300px" height="300px">
<h2>New Bed and Breakfast</h2>
<h1>Opening January 2015</h1>
<h4>Apple Tree House, Farndon Road, Woodford Halse, Northamptonshire</h4>
</header>

<div id="textcontainer">
---Basic text info here---
</div>

<footer>
<img src="root/footer.png" id="footbanner">
</footer>
</div>

</body>

</html>

还有我的 CSS:

html, body{
margin: 0;
padding: 0;

}

body {
background-color:#85A366;
font-family:Arial, Helvetica, Sans-serif;
font-size:12pt;
margin:0 auto;
padding-left:10px;
padding-right:10px;

}


#container{
width:80%;
height:100%;
padding-left:5px;
padding-right:5px;
padding-bottom:0px;
padding-top:0px;
text-align:center;
color:black;
background:#FFFFEE;
margin:0 auto;
font-family: Goudy Old Style,Garamond,Big Caslon,Times New Roman,serif;
font-weight:600;
font-style:italic;
font-size:13pt;
color:#7D5833;

}

h1, h2, h3, h4, h5, h6 {
color:#472400;
}
h1 { font-size: 40px; }
h2 { font-size: 32px; }
h4 { font-size: 24px; }

#textcontainer{

width:45%;
text-align:center;
margin:0 auto;
top:auto;
}

footer{
text-align:center;
height:100px;
}
#footbanner {
max-width:100%;
max-height:100%;
}

@media screen and (max-width:420px) {
table{
font-size:8pt;
}
#container {
width:100%;
}
}

您可以在其中看到任何使它在 Chrome 中运行但在其他浏览器中根本无法运行的东西吗?

最佳答案

<link/> type应该是 text/css不只是css如下图:

<link rel="stylesheet" type="text/css" href="stylesheet.css" />

关于html - CSS 在所有浏览器中都不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27063888/

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