试图让他们工作要花几个小时。还是一无所有。尝试使用media =“ xx”和@media。 CSS根本不起作用,或者只有其中一个起作用。我看不到明显的错误,它使我发疯。
<!DOCTYPE html>
<html lang="tr">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="stylesheet" href="1129.css" type="text/css">
</head>
<body>
<div id="header">
<ust>MYO</ust>
<p id="hosgeldiniz">Hoşgeldiniz</p>
</div>
<div id="content">What is Lorem Ipsum?
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</div>
<div id="footer"></div>
</body>
</html>
我还尝试了link => media =“ min-width”等,但它也无法正常工作。
CSS。
html body{
margin:0px;
padding:0px;
}
#header{
width:100%;
height: 10vw;
background-color:gray;
padding-top:40px;
text-align:center;
font-family: "Palatino Linotype", Times, serif;
}
ust{
font-weight:bold;
font-size: 3vw;
letter-spacing: 3px;
color:white;
}
#hosgeldiniz{
font-weight:bold;
font-size: 1.5vw;
letter-spacing: 3px;
color:white;
}
#content{
margin-top: 2%;
margin-left: 10%;
padding-right: 15%;
font-size:1.5em;
}
@media only screen and (max-width: 600px) {
#content {
font-size:0.1em;
}
}
这主要是代码,我应该添加更多详细信息,但是我即将入睡。 这主要是代码,我应该添加更多详细信息,但是我即将入睡。 这主要是代码,我应该添加更多详细信息,但是我即将入睡。 这主要是代码,我应该添加更多详细信息,但是我即将入睡。 这主要是代码,我应该添加更多详细信息,但是我即将入睡。
答案 0 :(得分:0)
我注意到的第一件事是您的CSS文件名以数字_
开头如果您使用Google文件命名约定,您会读到类似“ 在CSS文件名中只能使用字母a-z,数字0-9,下划线和连字符”。
但是-根据个人经验以及阅读/聆听其他程序员/开发人员的故事,我不愿意将数字放在首位。
在此网页的后半部分,有一条警告提示,文件名开头应使用数字>>> https://www.lifewire.com/naming-css-style-sheet-files-3466881
并且-如您在代码段中所看到的,我没有做任何更改,您的代码也可以正常工作。
这个答案可能有点冗长,但是我正在尝试将您的CSS文件名更改为字母顺序,然后在样式表链接中匹配该名称...并查看是否适合您
html body{
margin:0px;
padding:0px;
}
#header{
width:100%;
height: 10vw;
background-color:gray;
padding-top:40px;
text-align:center;
font-family: "Palatino Linotype", Times, serif;
}
ust{
font-weight:bold;
font-size: 3vw;
letter-spacing: 3px;
color:white;
}
#hosgeldiniz{
font-weight:bold;
font-size: 1.5vw;
letter-spacing: 3px;
color:white;
}
#content{
margin-top: 2%;
margin-left: 10%;
padding-right: 15%;
font-size:1.5em;
}
@media only screen and (max-width: 600px) {
#content {
font-size:0.1em;
}
}
<!DOCTYPE html>
<html lang="tr">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="stylesheet" href="1129.css" type="text/css">
</head>
<body>
<div id="header">
<ust>MYO</ust>
<p id="hosgeldiniz">Hoşgeldiniz</p>
</div>
<div id="content">What is Lorem Ipsum?
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</div>
<div id="footer"></div>
</body>
</html>