{"id":3453,"date":"2023-08-29T13:28:30","date_gmt":"2023-08-29T17:28:30","guid":{"rendered":"https:\/\/ubwp.buffalo.edu\/art320\/?page_id=3453"},"modified":"2026-03-18T11:23:28","modified_gmt":"2026-03-18T15:23:28","slug":"exercise-1-a-simple-web-page","status":"publish","type":"page","link":"https:\/\/ubwp.buffalo.edu\/art320\/exercises\/exercise-1-a-simple-web-page\/","title":{"rendered":"Exercise 1: A Simple Web Page"},"content":{"rendered":"\n<h2 class=\"wp-block-heading has-large-font-size\">Overview<\/h2>\n\n\n\n<p>This exercise will use some common HTML and CSS elements to create a simple web page.<\/p>\n\n\n\n<p>If you are using your own personal computer, please download and install <a href=\"https:\/\/code.visualstudio.com\/download\">Visual Studio Code<\/a> (unless you already have a code editor that you\u2019d prefer.)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">WWW Background<\/h2>\n\n\n\n<ul class=\"wp-block-list has-tertiary-background-color has-background\">\n<li>The World Wide Web was invented by Tim Berners-Lee in 1989 as a method of transmitting formatted text and images over a global network of computers.<\/li>\n\n\n\n<li>The Web\u2019s publishing language, Hypertext Markup Language (HTML) was described by Berners-Lee in 1991. It was purposefully designed to be simple and to have every low technical requirements in order to run on even the oldest and slowest computers.<\/li>\n\n\n\n<li>Users of computers on the Internet, known as&nbsp;<em>Clients<\/em>, request Web pages from other computers designated as <em>Servers<\/em>. The Server sends the HTML page (structured content) along with a CSS document (style) and any embedded images and media files to the Client.<\/li>\n\n\n\n<li>The client\u2019s&nbsp;<em>Web Browser<\/em>&nbsp;renders the HTML data and embedded media into a visual display formatted according to the data in the CSS file.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">HTML<\/h2>\n\n\n\n<p>HTML is plain text surrounded by tags (markup) which define the structured content of a page. Tags define give structure of the content of a page. Importantly, the anchor tag <code>&lt;a&gt;<\/code> allows some content to be clickable to link to other content (hypertext).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Structure &amp; Content<\/h3>\n\n\n\n<p>The structure of a document can be described by how a page is built. Think of a term paper \u2014 there might be a main heading, a table of contents, subheadings, and a number of paragraphs.<\/p>\n\n\n\n<p>Content can be text, images, video or interactive media.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Tags<\/h3>\n\n\n\n<p><a href=\"http:\/\/www.dontfeartheinternet.com\/02-html\/\">Watch \u201cDon\u2019t Fear HTML\u2014HTML\u201d<\/a>&nbsp;about understanding tags.<\/p>\n\n\n\n<p>Most elements begin with an&nbsp;<strong>opening tag<\/strong>, like &lt;p<code>&gt;<\/code>&nbsp;preceding some content, and then ends with a&nbsp;<strong>closing tag<\/strong>,&nbsp;<code>&lt;\/p&gt;<\/code>.<\/p>\n\n\n\n<p>A few elements are&nbsp;<strong>self-closing<\/strong>&nbsp;and are not wrapped around content. They are called&nbsp;<em>empty elements<\/em>&nbsp;and written differently:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>&lt;img \/&gt;<\/code>&nbsp;image<\/li>\n\n\n\n<li>&lt;hr \/&gt; horizontal rule<\/li>\n\n\n\n<li>&lt;br \/&gt; line break<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Structure \u2013 Not Style<\/h3>\n\n\n\n<p>Even though each browser has a default way of rendering the look of a tag&nbsp;<code>&lt;h1&gt;<\/code>&nbsp;heads are the largest and boldest,&nbsp;<code>&lt;h2&gt;<\/code>is smaller, and so on) HTML&nbsp;<strong>tags must not be used to define the look of content<\/strong>&nbsp;(style.) Instead, tags should logically define the structure of a page, representing the relative importance and structural aspects of each chunk of information being presented:&nbsp;<code>&lt;h1&gt;<\/code>&nbsp;elements are the most important,&nbsp;<code>&lt;h2&gt;<\/code>&nbsp;elements are secondarily important, and so on. This is crucial for accessibility \u2014 allowing a screen reader to assist a blind person\u2019s understanding of the information.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Required HTML Page Elements<\/h3>\n\n\n\n<p>Every HTML page must be minimally structured with these required elements:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n     &lt;head&gt;\n     &lt;\/head&gt;\n     &lt;body&gt;\n     &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>The first line must begin with&nbsp;<code>&lt;!DOCTYPE&gt;<\/code>. This is not an HTML element, but it&nbsp;tells the browser what language it\u2019s about to read. We use&nbsp;<code>&lt;!DOCTYPE html&gt;<\/code>&nbsp;for HTML5.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The data within the&nbsp;<code>&lt;html&gt;<\/code>&nbsp;tags makeup the HTML document.<\/li>\n\n\n\n<li>The data within the&nbsp;<code>&lt;head&gt;<\/code>&nbsp;tags contain information (metadata) about the page and&nbsp;<strong>will not be visible<\/strong>&nbsp;in the browser window.<\/li>\n\n\n\n<li>The data within the&nbsp;<code>&lt;body&gt;<\/code>&nbsp;tags contain the page\u2019s content that&nbsp;<strong>will be visible<\/strong>&nbsp;in the browser window.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Common HTML Elements<\/h3>\n\n\n\n<p>HTML provides the content, which is given structure by the use of markup tags. Tags almost always have an opening and a closing component.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>&lt;html&gt;\u2026&lt;\/html&gt;<\/code> \u2014 <em>Encapsulates the entire page<\/em><\/li>\n\n\n\n<li><code>&lt;head&gt;\u2026&lt;\/head&gt;<\/code> \u2014 <em>Contains metadata, or information about the page<\/em><\/li>\n\n\n\n<li><code>&lt;body&gt;\u2026&lt;\/body&gt;<\/code> \u2014 <em>Contains all content which will be visible to the user in the browser<\/em><\/li>\n\n\n\n<li><code>&lt;p&gt;\u2026.&lt;\/p&gt;<\/code> \u2014 <em>Creates a paragraph<\/em><\/li>\n\n\n\n<li><code>&lt;br \/&gt;<\/code> \u2014 <em>Adds a line break (self- closing, no closing tag needed)<\/em><\/li>\n\n\n\n<li><code>&lt;hr \/&gt;<\/code> \u2014 <em>Separates sections with a horizontal rule (self-closing)<\/em><\/li>\n\n\n\n<li><code>&lt;h1&gt;\u2026&lt;\/h1&gt;<\/code> \u2014 <em>Displays a heading (h1\u2013h6)<\/em><\/li>\n\n\n\n<li><code>&lt;! -- \u2026 --&gt;<\/code> \u2014 <em>Inserts a comment (readable by humans, not by browsers, to explain code)<\/em><\/li>\n\n\n\n<li><code>&lt;ol&gt;\u2026&lt;\/ol&gt;<\/code> \u2014 <em>Creates an ordered list<\/em><\/li>\n\n\n\n<li><code>&lt;ul&gt;\u2026\u2039\/ul&gt;<\/code> \u2014 <em>Creates an unordered list<\/em><\/li>\n\n\n\n<li><code>&lt;li&gt;\u2026&lt;\/li&gt;<\/code> \u2014 <em>A list item with an ol or ul<\/em><\/li>\n\n\n\n<li><code>&lt;img \/&gt;<\/code> \u2014 <em>Inserts an image into the document (self- closing)<\/em><\/li>\n\n\n\n<li><code>&lt;a&gt;\u2026&lt;\/a&gt;<\/code> \u2014 <em>Inserts a link into the document<\/em><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Common CSS Elements<\/h3>\n\n\n\n<p>CSS gives style (visual attributes, position on the page) to the html content and structure.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>margin<\/code> \u2014 Defines space between element border and parent<\/li>\n\n\n\n<li><code>padding<\/code> \u2014 Defines space between content and its border<\/li>\n\n\n\n<li><code>border<\/code> \u2014 Surrounds a content box with a solid or dashed line<\/li>\n\n\n\n<li><code>height<\/code> \u2014 the height of an elements box<\/li>\n\n\n\n<li><code>width<\/code> \u2014 the width of an elements box<\/li>\n\n\n\n<li><code>color<\/code> \u2014 foreground or type color<\/li>\n\n\n\n<li><code>background-color<\/code> \u2014 the color of a box\/container&#8217;s background<\/li>\n\n\n\n<li><code>background-image<\/code> \u2014 affixes an images to the background of a box<\/li>\n\n\n\n<li><code>font-family<\/code> \u2014 typeface name<\/li>\n\n\n\n<li><code>font-size<\/code> \u2014 specified in ems or percent<\/li>\n\n\n\n<li><code>font-style<\/code> \u2014 sets&nbsp;italic<\/li>\n\n\n\n<li><code>font-weight<\/code> \u2014 sets bold<\/li>\n\n\n\n<li><code>text-align<\/code> \u2014 left, right, center, justified<\/li>\n\n\n\n<li><code>text-decoration<\/code> \u2014 sets underline, overtone, strikethrough and blink<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\">Let\u2019s Write Code \u2014 HTML<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open Visual Studio Code (VS Code) and create a File&gt;New File. Name it index.html and Save it to a folder on your desktop titled &#8220;LASTNAME-Ex1&#8221;.<\/li>\n\n\n\n<li>Type in the HTML declaration to the top of the page: <code>&lt;!DOCTYPE html&gt;<\/code><\/li>\n\n\n\n<li>Type an opening and closing &lt;<code>html<\/code>&gt; tag, and hit Return a few time to add so me lines in-inbetween.\n<ul class=\"wp-block-list\">\n<li>It&#8217;s recommended to include a language &#8220;attribute&#8221; to the HTML tag, to inform the browser, screen readers and spell-checkers what language will be used on the page: &lt;html lang=&#8221;en&#8221;&gt;<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Between the &lt;<code>html<\/code>&gt; tags, create an opening and closing &lt;<code>head<\/code>&gt; element, and also a &lt;<code>body<\/code>&gt; element.<\/li>\n\n\n\n<li>In the &lt;<code>head<\/code>&gt; section, type the following to title your page (title it whatever you\u2019d like):<br><code>&lt;title&gt;<\/code>My First Website<code>&lt;\/title&gt;<\/code><\/li>\n\n\n\n<li>In the &lt;<code>body<\/code>&gt; section, create an &lt;h1&gt; heading, something like \u201cMy ART 320 Website\u201d.<\/li>\n\n\n\n<li>Create a <code>&lt;p&gt;<\/code> paragraph. Type whatever you\u2019d like. (Hint: type \u201cLorem\u201d and hit return.) Be sure to use a closing tag.<\/li>\n\n\n\n<li>Add a second <code>&lt;p&gt;<\/code> element, or more if you\u2019d like.<\/li>\n\n\n\n<li>Create an unordered list <code>&lt;ul&gt;<\/code> and populate it with a number of list items <code>&lt;li&gt;<\/code>.<\/li>\n\n\n\n<li>Type <code>shift-option(alt)-f <\/code>to Format (auto-indent) the lines of code.<\/li>\n\n\n\n<li>Examine your work by double-clicking the index.html file in your Ex1 folder. It will open in your default browser.<\/li>\n\n\n\n<li>In VS Code, change the unordered list <code>&lt;ul&gt;<\/code> to an ordered list <code>&lt;ol&gt;<\/code> and see what happens.<\/li>\n\n\n\n<li>Somewhere in your body section, add a cat image. Type <code>&lt;img src=\"https:\/\/placecats.com\/millie_neo\/300\/200\"&gt;<\/code>.<\/li>\n\n\n\n<li>Create a hyperlink. Type the following:<br>&lt;a href=&#8221;https:\/\/unsplash.com\/s\/photos\/cats&#8221;&gt;Have some cats!&lt;\/a&gt;<\/li>\n\n\n\n<li>Add a rule at the bottom of your content:<br><code>&lt;hr \/&gt;<\/code><\/li>\n\n\n\n<li>Add the following to the <code>head<\/code> section, to connect your html to a new CSS style sheet (which you will create in the next section):<br><code>&lt;link href=\"style.css\" rel=\"stylesheet\"&gt;<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Create CSS Styles<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In VS Code, create a new file titled style.css and save it to your Ex1 folder.<\/li>\n\n\n\n<li>Type the following;<br><code>body {<br>background-color: #9DBAF5;<\/code><br>margin: 50px 50px 50px 50px;<code><br>}<\/code><\/li>\n\n\n\n<li>View index.html in your browser to see the change.<\/li>\n\n\n\n<li>Add style for your paragraphs:<br><code>p {<br>width: 400px;<\/code><br><code>margin: 20px 0;<\/code><br><code>}<\/code><\/li>\n\n\n\n<li>Remove the underline from your links, and change the color:<br><code>a {<br>color: #f1991e;<br>text-decoration: none;<br>}<\/code><\/li>\n\n\n\n<li>Bonus steps:\n<ul class=\"wp-block-list\">\n<li>Change the color of your body background.<\/li>\n\n\n\n<li>Style the hr rule to match the width and margin of your paragraphs.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Overview This exercise will use some common HTML and CSS elements to create a simple web page. If you are using your own personal computer, please download and install Visual [&hellip;]<\/p>\n","protected":false},"author":295,"featured_media":0,"parent":35,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_EventAllDay":false,"_EventTimezone":"","_EventStartDate":"","_EventEndDate":"","_EventStartDateUTC":"","_EventEndDateUTC":"","_EventShowMap":false,"_EventShowMapLink":false,"_EventURL":"","_EventCost":"","_EventCostDescription":"","_EventCurrencySymbol":"","_EventCurrencyCode":"","_EventCurrencyPosition":"","_EventDateTimeSeparator":"","_EventTimeRangeSeparator":"","_EventOrganizerID":[],"_EventVenueID":[],"_OrganizerEmail":"","_OrganizerPhone":"","_OrganizerWebsite":"","_VenueAddress":"","_VenueCity":"","_VenueCountry":"","_VenueProvince":"","_VenueState":"","_VenueZip":"","_VenuePhone":"","_VenueURL":"","_VenueStateProvince":"","_VenueLat":"","_VenueLng":"","_VenueShowMap":false,"_VenueShowMapLink":false,"footnotes":""},"class_list":["post-3453","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/pages\/3453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/users\/295"}],"replies":[{"embeddable":true,"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/comments?post=3453"}],"version-history":[{"count":40,"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/pages\/3453\/revisions"}],"predecessor-version":[{"id":4432,"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/pages\/3453\/revisions\/4432"}],"up":[{"embeddable":true,"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/pages\/35"}],"wp:attachment":[{"href":"https:\/\/ubwp.buffalo.edu\/art320\/wp-json\/wp\/v2\/media?parent=3453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}