1 / 20

HTML Basics

HTML Basics. BCIS 3680 Enterprise Programming. Web Client/Server Architecture. Your browser (the client) requests a Web page from a remote computer (Web server). The Web server locates the requested page and, if the requested page is a dynamic page, executes programming code.

jada-daniel
Download Presentation

HTML Basics

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 Basics BCIS 3680 Enterprise Programming

  2. Web Client/Server Architecture • Your browser (the client) requests a Web page from a remote computer (Web server). • The Web server locates the requested page and, if the requested page is a dynamic page, executes programming code. • The Web server sends the resulting page to the client that requested it. • Each resource (a web page, a JPG file, a downloadable EXE file, etc.) on the Web server is uniquely identified by its Uniform Resource Locator (URL).

  3. What’s In a URL

  4. Default Page • If you don’t specify any file name, the Web server assumes that you want to access the “default page” in that directory. • They usually go by the name default.htm, default.html, index.htm, index.html, etc., as defined by the admin. • http://www.cob.unt.edu/itds and http://www.cob.unt.edu/itds/index.php both will bring up the page called index.php in the itds directory. • In the Tomcat jargon, a default page is a “welcome file”.

  5. ITDS Default Page

  6. Web Root • If you just enter the domain name, e.g., www.cob.unt.edu, the Web server assumes that you want to access the Web root directory. • Since only domain name is entered, there won’t be a directory for sure. In this case, you will get the default page in the root directory. • http://www.cob.unt.edu, and http://www.cob.unt.edu/index.php will all bring up the same index.php file in the root directory. • Note this file is different from the index.php in the itds directory.

  7. CoB Default Page

  8. Static Web Pages • A Web page author composes an HTML page, and saves it as an .htm or .html file. • A user types a page request via URL into the browser, and the request is sent from the browser to the Web server. • The Web server receives the page request and locates the .htm/html page in local file system. • The Web server sends the HTML stream back across the Internet to the client browser. • The browser interprets the HTML and displays the page.

  9. HTML • HTML is not case sensitive. • Two main components of an HTML page • Head • Body • HTML defines how text should be displayed on Web pages by using tags. The text enclosed between an opening tag and its matching closing tag is controlled by the tag.

  10. Writing HTML with Notepad Add “html” or “htm” file extension Change type to “All Files”

  11. HTML Elements • An element (“tag”) consists of an opening tag (e.g., <h1>) and a closing tag (e.g., </h1>). • Both contain a tag name between angled brackets. The only difference is the forward slash in the closing tag. • An element defines either the structural role or formatting instruction for the portion of the text between the opening and closing tags, e.g., • <h1> for level-1 heading • <b> for boldface

  12. HTML Elements

  13. Well-Formed Documents • Some elements do not enclose any text. They usually are structural elements, e.g., <br> for break, <hr> for horizontal bar. • Only the opening tag is really needed for these elements. • However, there is a trend toward “well-formed” markup documents. To be compliant, it’s a recommended practice to add a matching closing tag any ways. • A shorthand is to insert a space and a forward slash after the tag name in the opening tag, e.g., <br />. This is considered a well-formed element, even though there is only one tag.

  14. HTML Element Example • Each attribute is a name=value pair. • Quotation marks in the attribute are optional but often included. • An element can have multiple attributes, e.g., <a href="http://java.sun.com" target="_blank"> • Closing tag is the same as opening tag, with a “/” added to the front. • Not every element has attributes, e.g., the <i> element doesn’t.

  15. Dynamic Web Pages • In a dynamic page, certain contents do not exist before the page is requested. • The dynamic contents are generated upon request and often related to input provided by the user. • For example: • The current time on the Web server. • Page contents that show the current user’s username, first name, etc.

  16. Creating Dynamic Web Pages with JSP • JSP is a way to generate dynamic contents in Web pages. • It is a server-side scripting language. • You can mix regular HTML tags with JSP script in the same JSP page. • The JSP scripts, if any, are interpreted on the Web server (in fact, the application server does this). • The content generated by the execution of JSP code is integrated with HTML code and the resulting page is sent to the client browser.

  17. HTML Formatting • Instructs the browser on how to format and display HTML tags (elements). • HTML defines the structure of a document, e.g., <H1> to <H7> for headings of different levels; <p> for paragraph. • Although you may add attributes to these tags to define their formatting, there are shortcomings to this method: • The coding is fixed to the tag. Style defined in an <p> tag is good only for that particular instance of <p>. Any other <p> tags on the SAME document will not take on the same look. • If you want to update the looks of your page, you have to search the page, and find and fix every single instance of the tag you want to update. • Don’t even think about reusability on other pages.

  18. Cascading Style Sheets • The trend is to move toward the CSS. • If you define styles for the current sheet, you only need to define a style for a particular tag once. All instances of that tag within the page gets the same look. • If you define styles as a separate CSS document, you can link any number of pages to that document. All instances of a particular tag in all pages will look the same. This facilitates uniform looks across all pages on a site. • Updating only needs to be done at one spot. • A top-level style is inherited downwards unless overridden, e.g., <table> background will be inherited by <tr> and <td>. This is what “cascading” in the name means.

  19. Defining a Style • For styles defined within the page, use the <style> tag and put it in the <head> section. • A style name starts with a period (well, it’s fact more complex than that, but this is good enough for this course), followed by the name of the style. • A style can be composed by more than one aspect, e.g., font, font-size, font-style, background, foreground, etc. Each of these is defined in the form of attribute_name:attribut_value. Use semicolon to separate different name-value pairs. The semicolon after the last name-value pair is optional.

  20. Using a Style • To format an HTML tag using a defined style, add a name-value pair as an attribute of the tag in the format of: style = style_name

More Related