HTML and CSS: Design and Build Websites - Ebook written by Jon Duckett. Read this book using Google Play Books app on your PC, android, iOS devices. HTML & CSS Design and Build Websites JOn dUCKeTT JOHn WILeY & SOnS, . Many books that teach HTML and CSS I've focussed on the code you need to . Get this from a library! HTML and CSS: Design and Build Websites.. [Jon Duckett ] -- A full-color introduction to the basics of HTML and CSS from the publishers.
|Language:||English, Spanish, Portuguese|
|Genre:||Politics & Laws|
|Distribution:||Free* [*Registration Required]|
HTML and CSS: Design and Build Websites by Jon Duckett. Read online, or download in secure PDF format. Web Design with HTML and CSS Digital Classroom. Published How to create Web sites and applications with HTML, CSS Web Pages are coded in HTML. A full-color introduction to the basics of HTML and CSS from the publishers of Wrox! Every day, more and more people want to learn some HTML and CSS.
In HTML a information on two axes. The td stands for table data. You will learn how to control the borders of tables using CSS on pages and It can take the values: I added some CSS styles to this example so that you can see how the cells span more than one column. You will learn how to do this on pages , I have added some CSS styles to this example so that you can see how the cells span more than one row. You will learn how to apply these CSS styles to tables on pages , This is intended to make it easier for users to see which column the data is in however this functionality is not implemented by default in any current browser.
You will learn how to apply these CSS styles to tables on pages and The values for these attributes were given in pixels.
I added CSS styles to this example so that you can see the width of the table cells more clearly. If you want to control the width or spacing of tables and cells you should use CSS as shown on pages , There are it. Each cell of the table must be a row or column. X A table is drawn out row by row. X You can make cells of a table span more than one row or column using the rowspan and colspan attributes.
HTML borrows the concept of a form to refer to different elements that allow you to collect information from visitors to your site. Whether you are adding a simple search box to your website or you need to create more complicated insurance applications, HTML forms give you a set of elements to collect data from your users.
In this chapter you will learn: The best known form on the web is probably the search box that sits right in the middle of Google's homepage. In addition to enabling users to when registering as a member search, forms also allow users of a website, when shopping to perform other functions online, and when signing up for online.
You will see forms newsletters or mailing lists. AddInG TexT: Text input single-line Password input Text area multi-line Used for a single line of text such Like a single line text box but it For longer areas of text, such as as email addresses and names.
Radio buttons Checkboxes Drop-down boxes For use when a user must select When a user can select and When a user must pick one of a one of a number of options.
Submit buttons Image buttons File upload To submit data from your form Similar to submit buttons but Allows users to upload files to another web page. Ivy I vote for: It may also store the information in a database. The server creates a new You voted for Herbie Hancock. The server needs to know which piece of inputted data corresponds with which form element. In this example, the form asks for the visitor's username and also for their favorite jazz musician.
You should never change the name of a form control in a page unless you know that the code on the server will understand this new value. Its value is the URL for the page on the server that will receive the information in the form when it is submitted.
With the get method, the values With the post method the If the method attribute is not from the form are added to values are sent in what are used, the form data will be sent the end of the URL specified in known as HTTP headers. As a using the get method. The get rule of thumb you should use the method is ideal for: For example, in a login form, the server needs to know what has size been entered as the username The size attribute should not although a user could enter and what has been given as the be used on new forms.
It was more characters if they desired. Therefore, each form used in older forms to indicate control requires a name attribute. For example, a value of 3 would mentioned here because you create a box wide enough to may come across it when looking display three characters at older code. Its value is the number of characters they may enter. For example, if you were asking for a year, the maxlength attribute could have a value of 4.
R E S U LT name The name attribute indicates the name of the password input, which is sent to the server with the password the user enters.
However, if you are characters. The rows attribute looking at older code, you may indicates how many rows see the cols and rows attributes the text area should take up used with this element. Please note: Once a radio button option and want them to be The value of each of the buttons has been selected it cannot be able to deselect it for example in a group should be different deselected. The user can only if they are indicating they agree so that the server knows which select a different option.
If you to terms and conditions , you option the user has selected. The value of this attribute is checked. Only one radio button in a group should use this attribute. When a question provides users with options for answers in the form of checkboxes, the value of the R E S U LT name attribute should be the same for all of the buttons that answer that question.
If used, its value should be checked. R E S U LT name The name attribute indicates the name of the form control being sent to the server, along with the value the user selected. The value of this option can be selected. There be shown to the user in the drop attribute should be selected.
If this attribute is not used, the first option will be shown 1. If users need to see all options value when the page loads. If there is a very long list along with the name of the control. You can select more than one option by holding size down control on a PC or command key on a Mac You can turn a drop down select while selecting different options. R E S U LT multiple You can allow users to select multiple options from this list by adding the multiple attribute with a value of multiple.
It is a good idea to tell users if they can select more than one option at a time. It is also helpful to indicate that on a PC they should hold down the control key while selecting multiple options and on a Mac they should use the command key while selecting options. When the user clicks on the browse button, a window opens up that allows them to select a file from their computer to be uploaded to the website. You cannot send files using the HTTP get method.
When a user clicks on the browse button, the presentation of the window that allows them to browse for the file they want to upload will match the windows of the user's operating system. You cannot control the appearance of these windows. Different browsers will show submit buttons in different ways and tend to fit the visual presentation of the browser.
If you want to control the appearance of a submit button, you can either use CSS as you will learn on page , or you can use an image for the button.
These form controls are not shown on the page although you can see them if you use the View Source option in the browser. They allow web page authors to add values to forms that users cannot see. For example, a web page author might use a hidden field to indicate which page the user was on when they submitted a form. It can: Wrap around both the text description and the form input as shown on the first line of the example to your right.
Be kept separate from the form control and use the for attribute to indicate which form control it is a label for as shown with the radio buttons. The appearance of these lines can be adjusted using CSS.
Validating the contents of the form before it is sent to the server the helps: HTML5 validation, although other attribute, which can be used on browsers are expected to follow. So, some people give validate forms. HTML5 introduces new form controls to standardize the way that some information is gathered.
This will create a date input in browsers that support the new HMTL5 input types. This example shows what the date input looks like in the Opera browser.
The appearance of the date input changes across different browsers. Browsers that support HTML5 validation will check that the user has provided information in the correct format of an email address. Some smart phones also optimize their keyboard to display the keys you are most likely to need when entering a URL. Older browsers will simply treat it like a single line text box.
R E S U LT placeholder On any text input, you can also use an attribute called placeholder whose value is text that will be shown in the text box until the user clicks in that area. Older browsers simply ignore this attribute. It uses a variety of form controls. Different types of form control are suited to collecting different types of data. X Each form control is given a name, and the text the user types in or the values of the options they select are sent to the server.
X HTML5 introduces new form elements which make it easier for visitors to fill in forms. In this chapter, we will focus on some helpful topics that are not easily grouped together. Its purpose last with new elements and which have been highlighted , was to allow people to write attributes added and older code the elements you have seen in new markup languages.
Since removed. This meant that web users, however, have the authors are not recommended to authors had to follow some new, latest browsers installed on use them any more. XHTML was created because not need to close all tags, and it allowed authors to continue new elements and attributes will One of the key benefits of this to follow older practices with a be introduced. At the time of change was that XHTML works less strict syntax and use some writing, the HTML5 specification seamlessly with other programs of the elements and attributes had not been completed, but that are written to create and that were going to be removed the major browser makers had process XML documents.
Vector Graphics SVG — a 1. These days, frames are very long as you endeavour to ensure rarely used and are being phased that users with older browsers In order to help web page out. There must be nothing before it, not even a space. R E S U LT Although comments are not visible to users in the main browser window, they can be viewed by anyone who looks at the source code behind the page.
On a long page you will often see comments used to indicate where sections of the page start or end, and to pass on notes to help anyone who is looking at the code understand it.
Comments can also be used around blocks of code to stop that code from being displayed in the browser. In the example on the left, the email link has been commented out.
So very commonplace are these from other elements on the substances, they hardly attract attention - and page. Its value should start with yet they vouchsafe our very existence. As you will see when you come to look at CSS in the next R E S U LT section, giving an element a unique identity allows you to style it differently than any other instance of the same element on the page. For example, you might want to assign one paragraph within the page perhaps a paragraph containing a pull quote a different style than all of the other paragraphs.
In the example on the left, key paragraphs have a class attribute whose value is important. The class attribute on any element can share the same value. So, in this example, the value of important could be used on headings and links, too.
By default, using these attributes In this example, CSS has been If you would like to indicate that does not affect the presentation applied to make elements with an element belongs to several of an element.
It will only change a class attribute whose value classes, you can separate class their appearance if there is a CSS is important uppercase, and names with a space, as you can rule that indicates it should be elements with a class attribute see in the third paragraph in the displayed differently.
It is used to either: Contain a section of text where there is no other suitable element to differentiate it from its surrounding text 2. The content of the iframe can be any html page either located on the same server or anywhere else on the web.
There are a few attributes that you will need to know to use it: It can take one of three values: A value of 0 indicates that no border should be shown. A value of 1 indicates that a border should be shown. The seamless attribute like some other new HTML5 attributes does not need a value, but you will often see authors give it a value of seamless.
Older browsers do not support the seamless attribute. Some defined values for this web page. It is not visible to users but fulfills a number of purposes such as telling search engines description This contains a description about your page, who created of the page.
This description it, and whether or not it is time is commonly used by search sensitive. If the page is time engines to understand what the sensitive, it can be set to expire.
It uses attributes to carry the information. These attributes In practice, this no longer has specify properties of the entire any noticeable effect on how page. The value of the name search engines index your site. A value of noindex can be used if In the first line of the example on this page should not be added. The content attribute is where this description is actually specified.
Note that the date must be specified in the format shown. For example, the left and right angled brackets. Therefore, if you want these There are also special codes When using escape characters, characters to appear on your that can be used to show it is important to check the page you need to use what are symbols such as copyright and page in your browser to ensure termed "escape" characters trademark, currency symbols, that the correct symbol shows also known as escape codes or mathematical characters, and up.
This is because some fonts entity references. For example, some punctuation marks. In the to identify their purpose. X The id and class attributes allow you to identify particular elements. This chapter begins by looking at how to use it in your web pages.
Whether you are creating an When you create a Flash file in To view Flash, browsers need animation or a media player in the Flash authoring environment, to use a plugin an extra piece Flash, the files you put on your it is saved with the.
In order to use this file browser called the Flash Player. It has the. Flash plugin installed. The download the Flash authoring percentage of mobiles and environment from Adobe. When you export the movie tablets with it is much less. However, now it is more this chapter will show you how downloading this tool. The Flash authoring environment The. When Flash was first released, There are several reasons why There have been laws introduced it was developed to create fewer websites are using Flash to ensure that websites are animations.
The technology these days, including: At the time of when they use it and now rarely writing, Flash is still a popular consider building an entire When Apple launched the way of playing video and audio website in Flash. Despite this, Flash does have a decision not to support Flash. Here you can see some of the changes in how animation, video, and audio are created on the web. If it can, the achieve two further benefits: The text can be accessed by by the SWFObject script.
Flash movie, you could show a interact with the Flash file. The text can be indexed by can place the alternative content a text description of the Flash search engines which are not as for users who are not able to file.
The src attribute tells the browser where to find the script. This element is actually telling the SWFObject script five pieces of information, which are in the brackets: The location of the. The width of the Flash movie: The height of the Flash movie: The minimum version of the Flash player needed to view the movie: Online, there For this reason, browsers built service such as YouTube or are even more video formats prior to generally required Vimeo.
This a video into another format browser that supports this means you would need to upload is sometimes referred to as new HTML5 element and the any videos you want to show in "encoding" the video. There are several apps available video to be encoded in different on the web that enable you to formats. You do not need to worry about you need to host the video on encoding your video since your own server and add your We will be looking at two these sites allow you to upload own player into the page.
Once uploaded, they Some services will limit what Flash Video and the HTML5 automatically convert your video your video is allowed to include. Therefore, it can Some hosted services will play cost you extra to host the videos their own adverts before your on your own site.
This is included in the on pages It only supports the FLV format not H It is very similar to the one you saw in the earlier example that introduced SWFObject. Different video players usually require information such as the path to the video in slightly different formats, but they usually come with examples and documentation to help you understand how to use them.
Here are some of the key issues to be aware of: Therefore, controls for the player, and recent browsers, so you cannot you need to supply your video in these can vary from browser just use this one technique if you more than one format.
If the attribute is none should supply its own controls present, it turns that option on. The browser should not load for playback.
If the attribute is omitted, the the video until the user presses option is turned off. The browser should just collect indicates that the video should information such as the size, start playing again once it has first frame, track list, and ended. Otherwise, it will download some of the video to see if it can play the file which will take time and bandwidth. Or you may work you would only need to provide the other way around.
You would not need of the video for browsers it in FLV format as well. You that have different sized will see this demonstrated in screens so you can provide lower resolution content for the example at the end of the handheld devices chapter. As with video, there are three routes commonly taken: Browsers that provide a player which you can from simple buttons that play support this element provide embed in your page, such as one track to complex players their own controls — much as SoundCloud.
Some people ask how to get This is actually quite difficult This is why some sites offer music to play consistently even to achieve and would rely on audio players in new windows, when visitors move from one techniques like using AJAX to so that listeners are not page to another on a website.
If the browser does not support HTML5 video or Flash, then a plain text message will be shown to the user. X Flash is not supported on iPhone or iPad. CSS allows you to create rules that specify how the content of an element should appear. For example, you can specify that the background of the page is cream, all paragraphs should appear in gray using the Arial typeface, or that all level one headings should be in a blue, italic, Times typeface.
Once you have learned how to write a CSS rule, learning CSS mostly involves learning the different properties you can use. So this chapter will: On this page, you can see a basic HTML page. On the right hand page, you can see the same HTML page, but I have added outlines to each of the elements so that you can see how CSS will treat each element as if it lives inside its own box. In this example, block level elements are shown with red borders, and inline elements have green borders.
Using CSS, you could add a border around any of the boxes, specify its width and height, or add a background color. You could also control text inside a box — for example, its color, size, and the typeface used.
Italics, bold, uppercase, and forms. These rules govern how the content of specified elements should be displayed. A CSS rule contains two parts: The same rule can apply to the selector should be styled.
You can specify several properties in one declaration, each separated by a semi-colon. Arial; color: For example, color, font, properties. For example, if you typeface, in a yellow color. This example uses two documents: They are usually described as href early, second early and maincrop.
For example, some authors use one CSS file to control the presentation such as fonts and colors and a second to control the layout. They are usually described as an external CSS style sheet. Here is an example a style attribute on most of to that one element. You should that changes the color of the text the elements that appear in the avoid using this attribute in any in a single paragraph red: Here you can see the second i selector takes CSS precedence over the first.
In this color: It early and maincrop potatoes. Arial, Verdana, sans-serif; border properties; they are not color: If padding: When building a website there are several advantages to placing your CSS rules in a separate style sheet. All of your web pages can share Therefore, once the user has the one CSS style sheet, rather the same style sheet. If you want to make a will be easier to read and edit your site to link to the same CSS change to how your site appears, because it does not have lots of document.
This means that the you only need to edit the one CSS rules in the same document. For example, practice to have the content of results in less code and smaller you can change the style of the site separated from the rules HTML pages.
Again, than a separate document. This consider it better practice to most authors consider it better is simply to save you opening keep the CSS in a separate file. Work on CSS3 has been ongoing but the major browsers have already started to implement it.
In the same way that there have Browsers did not implement all This is mentioned when it is been several versions of HTML, CSS features at once, so some likely to affect you, along with there have also been different older browsers do not support notes where CSS properties versions of CSS. But finding and squashing those bugs is easy when you know how Before launching any new site, Using these tools, it is a good Some common browser bugs are it is important to test it in more idea to check the site on discussed in this book, but there than one browser, because there different operating systems PC, are many smaller bugs that only can be slight differences in how Mac, and Linux and in older occur in rare situations, or on old browsers display the pages.
You do not need lots of If you come across a CSS bug, computers to test your site, as When you look at your site in you can use your favorite search there are online tools to show more than one browser, you engine to try and find a solution. X Rules are made up of selectors that specify the elements the rule applies to and declarations that indicate what these elements should look like.
X Different types of selectors allow you to target your rules at different elements. X Declarations are made up of two parts: For example, the font-family property sets the choice of font, and the value arial specifies Arial as the preferred typeface.
In this chapter we will look at: DarkCyan We look at these three different ways of specifying colors on the next double-page spread. Anything long document into sections. RGB values, hex codes, and color names covered on the next page.
We have also used the padding property to separate the text from the edges of the boxes. This makes it easier to read and you will learn more about this property on page To find the color you want, you can use a color picker. Computer monitors are made up of thousands of tiny squares called pixels if you look very closely at your monitor you should be able to see them. When the screen is not turned on, it's black because it's not emitting any light.
When it's on, each pixel can be a different color, creating a picture.
The color of every pixel on the screen is expressed in terms of a mix of red, green, and blue — just like on a television screen. The hex value is provided next to the pound or hash symbol. There is also a good color picking tool at: However, between 0 and The of the green is color is MediumAquaMarine. Technically speaking of gray in a color.
At maximum to how much black is in a color. At minimum would be no black in the color. A lack of contrast is particularly If you want people to read a lot You can reduce contrast by a problem for those with of text on your page, however, using dark gray text on a white visual impairments and color then too much contrast can background or an off-white text blindness.
It also affects those with poor monitors and sunlight on their If text is reversed out a light color on a dark background , you screens which is increasingly can increase the height between lines and the weight of the font common as people use handheld to make it easier to read.
To check contrast there is a handy online tool at: This value is known as an alpha value and is a number between 0. The rgba value will only affect the element on which it is applied not child elements.
Because some browsers will not recognize RGBA colors, you can offer a fallback so that they display a solid color. To create the fallback, you can specify a color as a hex code, color name or RGB value, followed by the rule that specifies an RGBA value.
If the browser understands RGBA colors it will use that rule. If it doesn't, it will use the RGB value.
At the time of writing, the opacity and rgba properties are only supported by the most recent browsers. In HSL colors, hue is often gray in a color. Saturation is white lightness or black represented as a color circle represented as a percentage. Lightness is sometimes referred to as luminosity.
Please note that lightness is a different concept to brightness. Graphic design software such as Photoshop and GIMP have color pickers that use hue, saturation, and brightness — but brightness only adds black, whereas lightness offers both white and black. C8C8C8; The value of the property starts background-color: The hsla color property allows you to specify color properties using hue, saturation, and lightness as above, and adds a fourth value which represents Because older browsers do not This provides a fallback because transparency just like the rgba recognize HSL and HSLA values, if there are two rules that apply property.
The a stands for: This means that if the This is expressed as a color name. This should appear browser understands HSL and number between 0 and 1. Both use color names. The first provides a fallback color using a hex code and the second is an HSLA value for browsers that support this method.
Each paragraph is then shown in a different color to represent the varying levels of acidity or alkalinity, and these are specified using RGB values. The example also uses a property called margin to decrease the gap between the paragraph boxes, and a property called padding to create a gap between the edge of the boxes and the text within them.
These properties are covered on pages X There are three ways to specify colors in CSS: RGB values, hex codes, and color names. X Color pickers can help you find the color you want.
X It is important to ensure that there is enough contrast between any text and the background color otherwise people will not be able to read your content. It is known as RGBA. It is known as HSLA. As we look through these properties I will also give you some design tips on how to display your type. These details are have a much cleaner design.
Non-monospace fonts known as serifs. So, if the text is small, used for code because they align passages of text because they sans-serif fonts can be clearer nicely, making the text easier to were considered easier to read. Oblique versions of the font, letters are the amount of white space and font styles take the normal style thinner and closer together. In expanded versions they are thicker and further apart.
Times Verdana Times New Roman Helvetica As a result, sites often use a small set of typefaces that are installed on most computers shown above. There are some techniques to get around this limitation which are covered on pages It is possible to specify more than one typeface and create an order of preference in case the user does not have your first choice of typeface installed.
This is sometimes referred to as a font stack. They're not different widths.
For this reason, it is common to add the generic font name after your preferred choice of typefaces. For example, if you wanted serif type, you could write the following: However, typefaces are subject to copyright, so the techniques you can choose from are limited by their respective licenses.
CSS is used to be downloaded from if it is not access to a wider range of fonts specify the typeface. LICenSInG You are not distributing the The license to use the font must The service takes care of the typeface, so there is no licensing permit its distribution using licensing issues with the people issue.
Designers suggest pages usually look better if they use no more than three typefaces on a page. We will be using an extended version of the HTML shown on this page for all of the examples in this chapter. There are several ways to font-family: Arial, Verdana, sans-serif; specify the size of a font. Developing Backbone. This must stop. It is available as a PDF file, so you can easily download it and use it as per your convenience. Expert advice is provided by Cennydd Bowles, Louis Rosenfeld, Ash Maurya, and others on the 7 stages of product design.
Study Web Development Study Web Development is a free eBook on how to become a web developer and successful freelancer. Pixel Perfect Precision Handbook v. Designing for the Web By Mark Boulton A Practical Guide to Designing for the Web aims to teach you the techniques for designing your website using the principles of graphic design.
Pay Me… Or Else! Some things you just have to learn from someone who knows. However, there are many great bookS for learning web design. If you want to teach yourself web design, there are a few books that stand out as excellent for beginners.
Many of these are even used as textbooks for college classes. They control how you present your content to the end user. They approach web design as a technical exercise and come across like the kind of books you tried to avoid at school. Not this one. Jon Duckett has made the very sensible decision that a book on web design should be well designed, should look inviting and should show as much as it tells.