在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:mjhea0/thinkful-html开源软件地址:https://github.com/mjhea0/thinkful-html开源编程语言:HTML 81.2%开源软件介绍:Developed in conjunction with Thinkful. Come code along with me! Sign up here. Introduction to HTML and CSSWebsites are made up of many things, but HTML (Hyper Text Markup Language) and CSS (Cascading Style Sheets) are two of the most important components. Together, they are the building blocks for every single webpage on the Internet. Think of a car. It, too, is made up of many attributes. Doors. Windows. Tires. Seats. In the world of HTML, these are the Now let's turn to an actual web page .. RequirementsBefore we start, you need a source code editor, which is simply a text editor designed specifically for writing source code. Some popular editors include Notepad++ (Windows), TextMate (Mac), and Gedit (cross-platform). For this exercise, please download the cross-platform editor Sublime Text, which is an editor designed for simplicity and ease of use. Also, please make sure you have Google Chrome installed. HTMLHTML gives a web pages structure, allowing you to view it from a web browser: Start by adding some basic structure: <!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html> Copy and paste this basic webpage structure into your text editor. Save this file as index.html. This structure is commonly referred to as a boilerplate template. Such templates are used to speed up development so you don't have to code the features common to every single webpage each time you create a new page. Most boilerplates include more features (or boilerplate code), but let's start with the basics. What's going on?
This is how a standard HTML page is structured. Let's add four tags:
<!DOCTYPE html>
<html>
<head>
<title>My bumblebee website</title>
</head>
<body>
<h1 id="my-header">Bees!</h1>
<p>
<br/>
<img src="http://farm4.staticflickr.com/3775/12059206813_e37135c9cf_z.jpg" width="240" height="180"/>
<br>
</p>
</body>
</html> Open the page in Chrome; it should look like this: Elements, Tags, and Attributes
Additional TagsTwo additional tags are lists (ordered Putting it all togetherLet's add all the tags that were discussed. Headings<h2>Wonder, wonderful bumblebees</h2>
<h2>About the Bumblebee</h2>
<h2>Types of Bees:</h2>
<h3>(From <a href="http://en.wikipedia.org/wiki/Bumblebee">Wikipedia)</a></h3> Updated code: <!DOCTYPE html>
<html>
<head>
<title>My bumblebee website</title>
</head>
<body>
<h1 id="my-header">Bees!</h1>
<h2>Wonder, wonderful bumblebees</h2>
<p>
<br/>
<img src="http://farm4.staticflickr.com/3775/12059206813_e37135c9cf_z.jpg" width="240" height="180"/>
<br>
</p>
<h2>About the Bumblebee</h2>
<h3>(From <a href="http://en.wikipedia.org/wiki/Bumblebee">Wikipedia)</a></h3>
<br>
<h2>Types of Bees:</h2>
</body>
</html> ParagraphParagraphs: The <p>A bumblebee is any member of the bee genus Bombus, in the family Apidae. There are over 250 known species, existing primarily in the Northern Hemisphere although they also occur in South America. They have been introduced to New Zealand and the Australian state of Tasmania.</p> Updated code: <!DOCTYPE html>
<html>
<head>
<title>My bumblebee website</title>
</head>
<body>
<h1 id="my-header">Bees!</h1>
<h2>Wonder, wonderful bumblebees</h2>
<p>
<br/>
<img src="http://farm4.staticflickr.com/3775/12059206813_e37135c9cf_z.jpg" width="240" height="180"/>
<br>
</p>
<h2>About the Bumblebee</h2>
<h3>(From <a href="http://en.wikipedia.org/wiki/Bumblebee">Wikipedia)</a></h3>
<p>A bumblebee is any member of the bee genus Bombus, in the family Apidae. There are over 250 known species, existing primarily in the Northern Hemisphere although they also occur in South America. They have been introduced to New Zealand and the Australian state of Tasmania.</p>
<br>
<h2>Types of Bees:</h2>
</body>
</html> Ordered Lists<ol>
<li>Southern plains bumblebee</li>
<li>New garden bumblebee</li>
<li>Early bumblebee</li>
<li>Orange-belted bumblebee</li>
<li>Buff-tailed bumblebee or large earth bumblebee</li>
</ol> Updated code: <!DOCTYPE html>
<html>
<head>
<title>My bumblebee website</title>
</head>
<body>
<h1 id="my-header">Bees!</h1>
<h2>Wonder, wonderful bumblebees</h2>
<p>
<br/>
<img src="http://farm4.staticflickr.com/3775/12059206813_e37135c9cf_z.jpg" width="240" height="180"/>
<br>
</p>
<h2>About the Bumblebee</h2>
<h3>(From <a href="http://en.wikipedia.org/wiki/Bumblebee">Wikipedia)</a></h3>
<p>A bumblebee is any member of the bee genus Bombus, in the family Apidae. There are over 250 known species, existing primarily in the Northern Hemisphere although they also occur in South America. They have been introduced to New Zealand and the Australian state of Tasmania.</p>
<br>
<h2>Types of Bees:</h2>
<ol>
<li>Southern plains bumblebee</li>
<li>New garden bumblebee</li>
<li>Early bumblebee</li>
<li>Orange-belted bumblebee</li>
<li>Buff-tailed bumblebee or large earth bumblebee</li>
</ol>
</body>
</html> Check it out in your browser. Add some more elements, or let's move on to CSS so we can make the site look better. On to CSS .. CSSWhile HTML provides, structure, CSS is used for styling, making webpages look nice. From the size of the text to the background colors to the positioning of HTML elements, CSS gives you control over almost every visual aspect of a page. CSS and HTML work in tandem. CSS styles (or rules) are applied directly to HTML elements. For example, remember this element from above - #my-header {
color: #660000;
} Save this as "styles.css".
Next, we need to "link" our HTML page and CSS stylesheet. To do so, add the following code to the <link rel="stylesheet" href="styles.css"> Your code should now look like this: <!DOCTYPE html>
<html>
<head>
<title>My bumblebee website</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1 id="my-header">Bees!</h1>
<h2>Wonder, wonderful bumblebees</h2>
<p>
<br/>
<img src="http://farm4.staticflickr.com/3775/12059206813_e37135c9cf_z.jpg" width="240" height="180"/>
<br>
</p>
<h2>About the Bumblebee</h2>
<h3>(From <a href="http://en.wikipedia.org/wiki/Bumblebee">Wikipedia)</a></h3>
<p>A bumblebee is any member of the bee genus Bombus, in the family Apidae. There are over 250 known species, existing primarily in the Northern Hemisphere although they also occur in South America. They have been introduced to New Zealand and the Australian state of Tasmania.</p>
<br>
<h2>Types of Bees:</h2>
<ol>
<li>Southern plains bumblebee</li>
<li>New garden bumblebee</li>
<li>Early bumblebee</li>
<li>Orange-belted bumblebee</li>
<li>Buff-tailed bumblebee or large earth bumblebee</li>
</ol>
</body>
</html> Save the file. Check it out in your browser. See the difference? Yes, it's subtle - but the You can change certain elements even if they are not explicitly found within the HTML of the page, like the background color. Update your CSS file: body {
background-color: #FFFF00
}
#my-header {
color: #660000;
} Save. Refresh. What's going on?Look back at the CSS file.
Can you figure out what's going on with the Additional PropertiesYou can view all the available properties here. Pay attention to the font-related properties - like font-family, font-weight, and font-style - as you will be using these later. Margins, padding, and borders are also good properties to go over since they appear in almost every web page. Putting it all together
<!DOCTYPE html>
<html>
<head>
<title>My bumblebee website</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1 id="my-header">Bees!</h1>
<h2>Wonder, wonderful bumblebees</h2>
<p>
<br/>
<img src="http://farm4.staticflickr.com/3775/12059206813_e37135c9cf_z.jpg" width="240" height="180"/>
<br>
</p>
<h2>About the Bumblebee</h2>
<h3>(From <a href="http://en.wikipedia.org/wiki/Bumblebee">Wikipedia)</a></h3>
<p id="first-paragraph">A bumblebee is any member of the bee genus Bombus, in the family Apidae. There are over 250 known species, existing primarily in the Northern Hemisphere although they also occur in South America. They have been introduced to New Zealand and the Australian state of Tasmania.</p>
<br>
<h2>Types of Bees:</h2>
<ol>
<li class="odd">Southern plains bumblebee</li>
<li class="even">New garden bumblebee</li>
<li class="odd">Early bumblebee</li>
<li class="even">Orange-belted bumblebee</li>
<li class="odd">Buff-tailed bumblebee or large earth bumblebee</li>
</ol>
</body>
</html> Now, let's update the CSS file. /* this is a comment */
body {
font-family: arial, helvetica, sans-serif;
background-color: #FFFF00;
max-width: 500px;
text-align: center;
}
p {
line-height: 20px;
}
h1 {
font-style: italic;
text-transform: uppercase;
}
#my-header {
color: #660000;
}
#first-paragraph {
border-bottom-style: solid;
border-bottom-width: 2px;
border-bottom-color: #000000;
}
.even {
font-style: italic;
}
.odd {
color: red;
} Save. Refresh your browser. What do you think? Good. Bad. Ugly? Change the color of the background and header on your end. The color picker is nice for finding colors. Update the picture, too, if you want. Your turn!While I provide a brief review, work along with me to develop your own basic site.
Show it off! Chrome Developer ToolsUsing Chrome Developer Tools, we can not only view how someone added, for example, a CSS selector to make the HTML text to appear to hoover - but it's also an excellent means of testing either HTML or CSS changes directly from the browser. This can save a lot time Open up the HTML page we worked on. Right Click on the first paragraph. Select "Inspect Element". Notice the styles on the right side of the Developer Tools pane associated with the paragraph. Do you see the styles associated with the first paragraph? Go ahead and change the size of the border from 2px to 20px: Change the color of the even rows from black to something super cool. You can also edit your HTML in real time. With Dev Tools open, right click the text and select "Edit as HTML"
Extra Credit
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论