1 / 38

HTML, XHTML, CSS, & JAVAScript ~ an introduction ~

HTML, XHTML, CSS, & JAVAScript ~ an introduction ~. HTML (hyper text mark up language). Created by Tim Berners-Lee First time he used it was Christmas 1990 Publically introduced HTML in 1991 HTML totally adopted in 1993

elpida
Télécharger la présentation

HTML, XHTML, CSS, & JAVAScript ~ an introduction ~

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HTML, XHTML, CSS, & JAVAScript~ an introduction ~

  2. HTML(hyper text mark up language) • Created by Tim Berners-Lee • First time he used it was Christmas 1990 • Publically introduced HTML in 1991 • HTML totally adopted in 1993 • HTML caught on by 1995 world wide and companies like Yahoo and Amazon.com were created!

  3. Flavors of HTML • HTML 4 has three versions • HTML 4.01 Traditional • Encourages designers to move from the heavy coding of earlier forms of HTML and begin using CSS for formatting • HTML 4.01 Strict • Requires that only structure based code be used with all formatting handled by CSS • HTML 4.01 Frameset • Allows developers to create pages that utilize frames for page layout

  4. HTML elements and tags • HTML made up of elements • Elements describe to the browser how text should be treated • Elements are expressed in HTML as tags • < > this is a tag • Directions are given in between the brackets • <html>

  5. HTML Attributes • Attributes tell the browser specifics and act as additional information • Attributes come after the < but are finished before the > • Attributes are never repeated in a closing tag

  6. HTML Container Tags • Container tags use an opening tag, that has the element in the tag and a corresponding closing tag • A closing tag has a / before the element • <strong>some text to be bold</strong>

  7. HTML Empty Tags • Act as instructions to the browser • Do not contain content • No matching closing tag is necessary

  8. HTML Syntax Rules • Case insensitive • Upper or lowercase does not matter • Be consistent • Majority of web designers write in lowercase • Whitespace insensitive • In tags the element must immediately follow the opening angle bracket • you can put as much space or returns with out effecting the display of the page in the browser • Within the attribute you can use ‘ or “ • Be consistent

  9. XHTML(Extensible HTML) • Evolved from XML (extensible markup language) which was a language that allowed developers to create documents that focused on the data on the page, not how it would be displayed • W3C developed XHTML to eventually replace HTML 4.01 and used the same set of “flavors” • Transitional, strict, frameset • Requires that pages are written in a stricter XML syntax

  10. XHTML Syntax Rules • Case sensitive ….MUST BE LOWERCASE • Attribute values must be quoted…’ or “ • All attributes must have values • Tags must be properly nested • Closing tags are required • The only syntax rule that is the same between HTML and XHTML is that both are whitespace insensitive

  11. To make your XHTML code valid… • Must begin document with a document type declaration • This informs the browser which “flavor” you will be using to write your code • Some times called DOCTYPES • Looks complex, but will be exactly the same on every document that uses that type sooo…copy and paste

  12. DOCTYPE Examples • XHTML transitional DOCTYPE <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>

  13. DOCTYPE Examples • XHTML strict DOCTYPE <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict //EN” http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>

  14. DOCTYPE Examples • XHTML frameset DOCTYPE <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset //EN” http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd>

  15. Declaring the XHTML namespace • Technically written in XML so must define the XHTML namespace • Technical and not totally necessary to fully understand it • Will be the same on all your documents, regardless of the DOCTYPE you are using • It is an added attribute to the first tag in your page which is the <html> tag <html xmlns=“ http://www.w3.org/1999/xhtml>

  16. Advantages of XHTML • Can validate XHTML for free using on line resources • Browsers will not throw out any errors will just try to understand your code as best they can and still show page • By declaring the flavor with the DOCTYPE you can check your code with a validator • Requires you write better, cleaner code making it easier to edit and maintain later • “Future proof”..by declaring the language you are using from the beginning browsers in the future will be able to correctly render your pages • By writing in XHTML Strict you can separate the content of your pages (the XHTML and the CSS)…which means more flexibility.

  17. CSS • Developed in effort to provide more robust formatting language for the web. • Can be used with any web page and any DOCTYPE • Created in 1996 • Introduced text formatting, indents, spacing, alignment, padding, borders

  18. CSS Browser Support • Current version is CSS 2.0 and almost all browsers support CSS • Some browsers may not implement the CSS exactly to the standards so some pages may render differently

  19. BASIC CSS SYNTAX • CSS relies on a different syntax then XHTML • Instead of elements and tags, CSS uses rules • Made up of a selector and declarations

  20. BASIC CSS SYNTAX • The selector is a reference to the portion of the XHTML document that should be formatted • Can be XHTML element or a special CSS selector such as an ID or class.

  21. BASIC CSS SYNTAX • Declarations are made up of property values pairs. • Each property is separated by its value by a colon, and each declaration is separated from the next by a semicolon. All of the declaration is enclosed in curly braces. • p {color: #ff0000; font-weight:bold;}

  22. BASIC CSS SYNTAX • CSS selectors are case sensitive • Declarations are case insensitive • CSS is white space insensitive • Properties that contain more than one word, like font-weight, separate the words with hyphens. • If a property value needs more than one word, like with TNR for a font, the values need to be in quotation marks.

  23. Inheritance…. • XHTML docs are made up of nested sets of elements which creates a parent-child relationship. • Many – BUT NOT ALL, CSS properties inherit from parent-to-child elements. • So, if you have a paragraph that has a span, the span will inherit most of the parent’s properties, especially those referring to test and font styles.

  24. CSS Advantages • Provides many formatting options not available in HTML • Pages that use CSS load and render more quickly • You can reformat an entire site • You can repurpose your site with out rewriting it

  25. What the ‘cascade’ means • If you have more than one style rule applied to the same element on your page it gets fixed by using the cascade • Style rules closer to the element in question take precedence over those farther away. • More specific rules override less specific rules • So an ID selector that targets one specific element will take precedence over a general element

  26. To depict the cascade…. p {color:#999999; font-weight:bold; } p#heading {color:#000099; } • This means a paragraph with an ID of heading would be dark blue (000099) from the more specific p#heading rule but would also be bold because the more specific font weight property coming before.

  27. Linking and Importing CSS • Keep your style sheet info in a separate document • Separates content from presentation • Can apply same style sheet to multiple pages • Create one design for your entire web site • Two ways to attach CSS style sheet • Link (most common) • @import

  28. Attaching CSS Value of type is always text/css Value of rel attribute is almost always stylesheet <link rel=“stylesheet” type=“text/css” href=“path_to_css_document” /> • All 3 attributes are required

  29. Attaching CSS Importing your style sheet through the special CSS 2iport rule….appears within an XHTML style tag: <style type=“text/css”> @import (“path_to_css_document” ) ; </style>

  30. Getting started with CSS • Why use them? • Give greater control over the presentation and formatting of your site • Can place styles within a web site or use external style sheets • What tag do we use? • Style tag after the head tag

  31. Tag block, selectors, etc. • Within the tag block you will create your stlye rules • Each rule has a selector • Many types • We will first use element selector • This means an XHTML element is being used somewhere on the page and we want to format the element accordingly • Declarations are made after the selector • Made up of property and value

  32. Property and values • Separated by a colon ( : ) • Each pair is separated from each other pair by a semi colon ( ; ) • Entire block of declarations is wrapped by a pair of curly braces to offset it from the selector <style type=“text/css”> p {color:#ff0000;} </style>

  33. Creating a CSS of your own • Terms to understand • FIXED • ELASTIC • LIQUID • HYBRID

  34. Fixed CSS • Column width is specified in pixels • Column does not resize based on the size of the browser or the site visitors text settings

  35. Elastic CSS • Column width is specified in a unit of measurement (ems) relative to the size of the text • The design adapts if the site visitor changes the settings, but does not change based on the size of the browser window

  36. Liquid CSS • Column width is specified as a percentage of the site visitors browser width • The design adapts if the site visitor makes the browser wider or narrower, but does not change based on the site visitors text settings

  37. Hybrid • Columns are a combination of any of the previous three options • For example, the 2 column hybrid, right side bar layout has a main column that scales to the size of the browser and an elastic column on the right that scales to the size of the site visitors text settings

More Related