Web Design & Development I Show
Version 2.0 Student Version
The following are some facts about HTML tags (plus a few facts about XHTML tags too):
DOCTYPE: Defining your version of HTMLEvery web page must start with a DOCTYPE declaration. It has to be the very first item on the very first line of your HTML or XHTML code. This tells browsers what version of HTML the web page was coded in, which helps them to know how to process the code. Prior to HTML5, DOCTYPE declarations were long and complex. For example, here's the DOCTYPE declaration for XHTML 1.1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> In HTML5, the DOCTYPE declaration is much simpler: <!DOCTYPE html> Common HTML tags are presented below, organized into four tables based on their purpose. The first table includes tags that control the overall structure of the web page. The second and third tables include tags that mark up the majority of web page content. Container tags (those that contain content) are presented in the second table, and non-container tags (those that stand alone) are presented in the third table. The final table contains tags that are used in markup of HTML tables, which are covered in Module 5 of this unit. Document Structure
Content (Container) Tags
HTML5 Semantic TagsHTML5 introduced several new tags called semantic tags. These tags were designed to communicate the function of blocks of content that were common on many web pages. Prior to HTML5, developers just used <div> tags for all blocks.
Empty (Non-Container) TagsTables
Figure: Good Example <breakfast_menu> <food> <name>Homestyle Breakfast</name> <price>$6.95</price> <description>two eggs</description> <calories>950</calories> </food> </breakfast_menu> Figure: Good Example <div> <p>Hello HTML </div> Figure: Bad Example <breakfast_menu> <food> <name>Homestyle Breakfast <price>$6.95 <description>two eggs <calories>950 </food> </breakfast_menu> Figure: Bad Example There are many scenarios where you need some extra space in a web page. No matter which one you are at, CSS is the answer. Sometimes the first thing that comes to the developer mind is to use the "break line" tag (<br />) or the ASCII character code for "space" ( ) to create these extra spaces. It's wrong. CSS is the way to go. You can use both "margin" or "padding" CSS properties to get the result you want. <ul> <li>   List item</li> </ul>Figure: Bad Example - Using the "space" ASCII character to create a padding on that list <ul> <li>List item</li> </ul> <br /> <br /> <br />Figure: Bad Example - Using the <br /> tag to create a space at the bottom of that list ul {margin-bottom:15px;} ul li {padding-left:10px;}Figure: Good Example - Using CSS to add a margin at the bottom of the list a the padding on the left side of each list item Tip: You might be not familiar with editing a CSS file... In this case, contact a designer, they will be more than happy to help you. The attribute "name" allows you to link to specific places within the page, via the <a> tag. This is especially useful in long pages that can be separated into sections. You can create a named anchor in each of these section headings to provide "jump-to" functionality. In other words, you can have a different URL for each piece of content on the same page. <h2><a name="get-started"></a>Get Started</h2> Figure: This is how you add an anchor name to an specific section of your page. Note it doesn't have the hash mark and the anchor tag is empty You now have a custom URL that points to the specific section of the page. It is the page URL followed by the hash mark and the name you chose: http://www.yourpage.com#get-started Figure: This is how your custom URL will look like You can use this new URL to point users to that specific section of your page. To create a link to your anchor named section inside the same page, simply add a new "href" anchor tag - now with a hash mark followed by the name you chose:<a href="#get-started">Go to Get Started section</a> Figure: This is how you add a *link* to that anchor name you created inside the same page. Remember to add the hash mark Tip #1: Use the hash mark only to go to the top of a page. E.g. <a href="#">&Go to top</a> Tip #2: Some browsers consider capitalization for anchor names (E.g. Firefox). Always check your links and anchor names are identical, matching the capitalization. You should design a website to look good when being viewed in Google Chrome, Mozilla Firefox, the latest version of Edge and Safari unless the client specifically requests otherwise. There are a lot of other browsers available, but it is important to consider that most other browsers are based on the most used browser nowadays. Note that readable is not perfect. There may be some page elements that are less than perfect, but it's just not worth of time to fix small bugs in every single browser, except for Google Chrome. You must test your website on the major browsers, though, because that there will be more differences and problems than you would think. The typical things that you will need to fix are:
You should be able to fix all formatting and layout bugs by editing the CSS file. Note: If a browser represents less than 2% of your website views in Analytics, then you shouldn't bother. E.g. Google archived this link - https://code.google.com/archive/p/html5-js/ - which was used as an HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries. Since IE represents a small percentage of views it can be removed instead of updated to a new working shim. When a user looks at a search result, they expect to see a list of items to look into. If there are no results, don't give them noisy text because it can be taken as a search result. An icon also can be understood as a broken page. Your "no results" page should be clean. Note: In case the message you're showing is a "pass" or "fail, it is recommended to use an icon as per Do you use icons to enforce the text meaning? There are two ways of arranging labels and inputs on an html form, but each should be used in a specific scenario. When arranging labels and inputs on your html form, align labels next to the inputs on medium and large displays. When arranging labels and inputs on your html form, align labels above inputs on small and extra-small displays. Bootstrap makes this easy. Read Do you use the css class "form horizontal" to arrange your fields and labels? to know more. The HTML list tags <ul> and <ol> should be used for unordered and ordered lists only . Tip: If your list tag (<ul> or <ol>) doesn't have a list item (<li>) inside it, then it's not a list. Consider using another HTML tag (E.g. <p>). Figure: Bad Example - Using the <ul> for a text <ul><li>A list item</li></ul> <ol><li>A list item</li></ol> Figure: Good Example - Using the <ul> and <ol> for lists To keep profile management simple and make it easier for users to have a consistent experience across applications, you should use Gravatar for showing profile images in your application. Your Gravatar is an image that follows you from site to site appearing beside your name when you do things like comment or post on a blog. Setting up Gravatar in your applicationIt is simple to set up and if you are developing an MVC application, there are even several Nuget packages to make your life easier. The GravatarHelper is recommended. @Html.GravatarImage("", 80, new { Title = "My Gravatar", Alt = "Gravatar" })Also, check out the Gravatar API documentation for all the options available. The below short video shows how to get up and running with Gravatar in your ASP.NET MVC application.
If possible you should always use hyperlinks to open new pages on your site instead of using JavaScript. There are two good reasons for avoiding JavaScript-powered links:
Figure: Bad Example - This link can't be clicked on if you paste it into an email or if JavaScript is off <a href="mynewpage.html">Open a new page</a>Figure: Good Example - This link can still be clicked on when pasted and when JavaScript is turned off The text of a URL should make sense and relate to the content of the relevant page. Apart from helping with Google Juice users frequently read URL's. There are a few options for how you format the text of a URL. The following suggestions are in preference order:
You can install the IIS URL Rewrite Module for IIS7 you can make ugly URL's much more friendly. The caveat here is that it will only work if the URL is in the clear on the page. Note: This could only be done with certain links as others are postbacks as well. The best way to show the features of a product is creating a video. The information you are able to communicate in seconds of a video would take hundreds of words of text to explain. Videos are also important for services, but for products, it should be on the homepage . Videos are also good for SEOBy embedding videos onto your website it will help get the videos more views, which is a determinant for Google nowadays. Consistency across your similar pages (such as standards pages in this case) is very important and should be made easy to implement. Guidelines and standards for the SSW website pages can be found at SSW Web Design References . A stylesheet file (.CSS) should be used to dictate how the fonts, headings, tables, captions and everything else on your HTML should be displayed. This makes your site very easy to maintain. If you ever want to change the entire look and feel you should only have to change one file. We have a rule on using relevant words on links. How to make sure people will know which words are links and what the links are after printing a page? As a good practice, you should use CSS to print the URL's next to each link when printing: @media print { a[href]:after { content: " (" attr(href) ")"; } }In specific cases, like on breadcrumbs and logo, you don't want these URL's, so you should override the style: @media print { .breadcrumba[href]:after { content: none; } When you embed a YouTube video it will increase your page size from 500kbs to 1.5Mb or more, depending on how many videos are embedded on the page. Figure: Bad example – The evil HTML code There is a clever, lightweight way to embed a YouTube video, which Google itself practices on their Google+ pages which reduce it to 15kbs.All you have to do is, whenever you need to embed a video to a page, add the below tag instead of the YouTube video embed code. (Remember to replace VIDEO_ID with actual ID of the YouTube video) <div class="youtube-player" data-id="VIDEO_ID"></div>Figure: Good example – The good HTML code Note: This script needs to be added at the end of the document: <script> /* Light YouTube Embeds by @labnol */ /* Web: http://labnol.org/?p=27941 */ document.addEventListener("DOMContentLoaded", function () { var div, n, v = document.getElementsByClassName("youtube-player"); for (n = 0; n < v.length; n++) { div = document.createElement("div"); div.setAttribute("data-id", v[n].dataset.id); div.innerHTML = labnolThumb(v[n].dataset.id); div.onclick = labnolIframe; v[n].appendChild(div); } }); function labnolThumb(id) { var thumb = '<img src="https://i.ytimg.com/vi/ID/hqdefault.jpg">', play = '<div class="play"></div>'; return thumb.replace("ID", id) + play; } function labnolIframe() { var iframe = document.createElement("iframe"); var embed = "https://www.youtube.com/embed/ID?autoplay=1"; iframe.setAttribute("src", embed.replace("ID", this.dataset.id)); iframe.setAttribute("frameborder", "0"); iframe.setAttribute("allowfullscreen", "1"); this.parentNode.replaceChild(iframe, this); } </script>..and this needs to be added in the CSS: <style> .youtube-player { position: relative; padding-bottom: 56.23%; /* Use 75% for 4:3 videos */ height: 0; overflow: hidden; max-width: 100%; background: #000; margin: 5px; } .youtube-player iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 100; background: transparent; } .youtube-player img { bottom: 0; display: block; left: 0; margin: auto; max-width: 100%; width: 100%; position: absolute; right: 0; top: 0; border: none; height: auto; cursor: pointer; -webkit-transition: 0.4s all; -moz-transition: 0.4s all; transition: 0.4s all; } .youtube-player img:hover { -webkit-filter: brightness(75%); } .youtube-player .play { height: 72px; width: 72px; left: 50%; top: 50%; margin-left: -36px; margin-top: -36px; position: absolute; background: url("//i.imgur.com/TxzC70f.png") no-repeat; cursor: pointer; } </style>"Adaptive placeholders" are form labels that become into placeholders and vice-versa, depending on which fields have been filled or not. It gives your website a great UX. It's also a nice way to save space and achieve a neat visual appearance. Using this method users can easily to tell which field has been filled in and which data has been entered. |