简体   繁体   English

我的 CSS #wrapper 样式需要使用 div 应用于 HTML 文档

[英]My CSS #wrapper style needs to be be applied to a HTML document using div

My main focus is to get my current default.htm document formatted from the #wrapper CSS I have in another folder.我的主要重点是从另一个文件夹中的#wrapper CSS 格式化我当前的 default.htm 文档。 I cannot figure out where the error is as when I go to open my default.htm I have no formatting.我无法弄清楚错误在哪里,因为当我打开我的 default.htm 我没有格式。 My main focus is to get my current default.htm document style from the #wrapper CSS I have in another folder.我的主要重点是从另一个文件夹中的 #wrapper CSS 中获取我当前的 default.htm 文档样式。 I cannot figure out where the error is as when I go to open my default.htm I have no formatting.我无法弄清楚错误在哪里,因为当我打开我的 default.htm 我没有格式。

 <!doctype html>
 <html lang="en">
 <head>
 <title> Avery Owen's INFO1311 Home Page </title> 
 <meta charset="UTF-8">
 </head>
 <body>
 <div id="wrapper">

 <h1> Avery Owen's INFO 1311 Web Site </h1>
 <h2> Winter 2019 </h2>
 <h3> Homework Assignments</h3>
 <ul>
 <li><a href="module2/assignment2.css">Assignment 2</a></li>
 <li> Assignment 3</li>
 <li> Assignment 4</li>
 <li> Assignment 5</li>
 <li> Assignment 6</li>
 <li> Assignment 7</li>
 </ul>
 <h3> Final Project Home Page </h3>
 <h3>Important Links</h3>
 <ul>
 <li> <a href="http://blackboard.mccneb.edu">Blackboard Course Web Site </a>
 <li> <a href="http://www.mccneb.edu">Metro Web Site </a>
 <li> <a href="http://validator.w3.org">W3C HTML Validator </a>
 <li> <a href="http://jigsaw.w3.org/css-validator/">W3C CSS Validator </a>
 </ul>
<footer><p> Created by <a href="aowen6@mail.mccneb.edu">Avery Owen </a></p></footer>
</div>
</body>
</html>

and here is where I am pulling from这是我从哪里拉

body{background-color: red;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
}


#wrapper{width: 900;
background-color: white;
margin-left: auto;
margin-right: auto;
}



header{background-color: yellow;
}


h1{font-family: Trebuchet MS, sans-serif;
color: green;
text-shadow: black;
}



h2{color: red;
margin-top: -20;
margin-left: 30;
}



h3{color: blue;
text-shadow: yellow;
}



footer{background-color: gray;
color: blue;
text-align: right;
font-size: .8em;
font-style: italic;
}

You need to reference the stylesheet in the header of the page inside <head> tags.您需要在<head>标签内的页面标题中引用样式表。

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

Change the href path to the path of your stylesheet.将 href 路径更改为样式表的路径。

I would highly recommend using a text and source code editor such as Atom , Sublime text or VS Code if you are not doing so already.如果您还没有这样做,我强烈建议您使用文本和源代码编辑器,例如AtomSublime textVS Code You can simply open up the files together in windows inside the editor which is very convenient.您可以简单地在编辑器内的窗口中一起打开文件,这非常方便。 In your HTML code you must insert a link tag to get the code from the .css file, and insert it inside your head tags:在您的 HTML 代码中,您必须插入一个链接标记以从 .css 文件中获取代码,并将其插入到您的 head 标记中:

<link rel="stylesheet" href="css/styles.css">
<!-- the href format is folder_name/file_name.css

,the folder must be stored in the same hierarchical level in your directory as the default.html file you are linking it to in this case --> , 在这种情况下,该文件夹必须存储在您目录中与您将其链接到的 default.html 文件相同的层级中 -->

Here is how the format should look inside your .css file以下是格式在 .css 文件中的外观

 /********************ID SELECTORS*******************/
        /*EXAMPLE OF FORMAT*/
        #wrapper{
          width: 15em;
          border: 1px solid #333;
          box-shadow: 8px 8px 5px #444;
          padding: 8px 12px;
          background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc);
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM