For the World Wide Web Styling Tables with CSS

Slides:



Advertisements
Similar presentations
Use Tables for Layout Control Day 7. You will learn to: Understand Tables Create a Simple Table Modify Your Tables Appearance Create Page Layouts with.
Advertisements

Chapter 3 – Web Design Tables & Page Layout
Working with Web Tables
Cascading Style Sheets
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Creating Tables Text Tables -created by using preformatted tags. Graphical Tables - created using Table Structure with HTML.
Tutorial 4: Designing a Web Page with Tables
Cos 125 Day 22. Agenda Assignment 6 Not corrected Waiting for tune-ins Assignment 7 is posted Assignment 7 Due April 2PM Left to do 1 Assignments.
XHTML1 Tables and Lists. XHTML2 Objectives In this chapter, you will: Create basic tables Structure tables Format tables Create lists.
XP 1 New Perspectives on Creating Web Pages with HTML Tutorial 4: Designing a Web Page with Tables.
XP 1 Designing a Web Page with Tables Tutorial 4 Creating a News Page.
Cos 125 Day 24. Agenda All students meeting 7 Pm Monday, April 19 UMS Strategic Plan Assignment #7 Posted Due April 20 Two (one?) more to go Quiz Four.
Creating a Web Page with Tables. Objectives Create a text table with preformatted text Create the basic structure of a graphical table Organize table.
Introducing Web Tables
XP Creating Web Pages with HTML Using Tables. XP Objectives Create a text table Create a table using the,, and tags Create table headers and captions.
Using HTML Tables.
1 Tables: Data in Rows and Columns – What is Table? – How Tables are Used? – Designing Tables – Table, Cell, Row Attributes – Using Tables for Alignment.
Creating Tables in a Web Site Using an External Style Sheet HTML5 & CSS 7 th Edition.
HTML. Creating a Table Attributes: border: indicates the border type of the table Value: 0 (no border), 1, 2, etc. cols: indicates the number of columns.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 06: Tables - Spring 2011.
HTML Tables and Forms Creating Web Pages with HTML CIS 133 Web Programming Concepts 1.
HTML Essentials Tables and Table Tags. Overview Use of Tables goes beyond tabulating data Frequently used to format Web pages / control layout Especially.
Chapter 5 Working with Tables. Agenda Add a Table Assign a Table Border Adjust Cell Padding and Spacing Adjust Cell Width and Height Add Column Labels.
XP 1 Tutorial 4 Designing a Web Page with Tables.
XHTML1 Tables N100 Creating a Simple Web Page. XHTML2 Creating Basic Tables Tables are collections of rows and columns that you use to organize and display.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorial 5: Working with Tables.
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
CHAPTER 11 Tables. How Are Tables Used Data Display  Very tidy and very useful Better Text Alignment  Putting text in tables allows you to format indents.
Tutorial 6 Creating Tables and CSS Layouts. Objectives Session 6.1 – Create a data table to display and organize data – Modify table properties and layout.
HTML, Third Edition--Illustrated Introductory 1 HTML, Third Edition Illustrated Introductory Unit F Working with Tables.
Creating Tables in a Web Site
HTML Comprehensive Concepts and Techniques Second Edition Project 3 Creating Tables in a Web Site.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
Tables Learning Web Design: Chapter 8. Overview of Tables Uses for tables How to create a table Using CSS to style a table Nested tables Advanced table.
CNIT 132 – Week 7 HTML - Tables. Tables on the World Wide Web A table can be displayed on a Web page either in a text or graphical format. A text table:
Designing a Web Page with Tables. A text table: contains only text, evenly spaced on the Web page in rows and columns uses only standard word processing.
Tutorial 5 Working with Tables and Columns
Tutorial 5 Working with Tables and Columns
XP Creating Web Pages with HTML, 3e Prepared by: C. Hueckstaedt, Tutorial 4 1 New Perspectives on Creating Web Pages with HTML Tutorial 4: Designing a.
Introducing Web Tables. Tables for tabulating items  Better looking  More flexibility  More efficient to explain information than plain text.
Tutorial 5: Tables Session OBJECTIVES Marking row groups Marking column groups Setting the table frame Specifying the table’s internal gridlines.
TABLES 1. In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert.
ECA 228 Internet/Intranet Design I Tables. ECA 228 Internet/Intranet Design I Basic HTML Tables Created as a way to present rows and clumns of data.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
CIS234A- Lecture 7 Instructor Greg D’Andrea. Tables A table can be displayed on a Web page either in a text or graphical format. A text table: – contains.
 2003 Prentice Hall, Inc. All rights reserved. Introduction to HTML: Tables Outline 1 Introduction 2 Basic HTML Tables 3 Intermediate HTML Tables and.
CIS234A Lecture 8 Instructor Greg D’Andrea. Review Text Table contains only text, evenly spaced on the Web page in rows and columns uses only standard.
COS 125 DAY 14. Agenda  Assignment 6 DUE  Assignment 7 Posted Due March 9:35 AM  Quiz 2 will be on March 30 Chapters M/C and 4 Short.
Web111a_chapt04.ppt HTM: Section 4 Tables Table Types Text table elements Easy to use Use fixed-font text (font family monospace) Andale Mono Courier Monaco.
Tutorial 5 Working with Web Tables. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Learn and Apply the structure of.
Tutorial 5 Working with Web Tables
Designing a Web Page with Tables
CNIT 131 HTML5 - Tables.
Working with Tables and Columns
Yourfriendmanoj.wordpress.com Fb/yourfriendmanoj
Working with Tables: Module A: Table Basics
Cao Yuewen SEEM4570 Tutorial 03: CSS Cao Yuewen
LAB Work 02 MBA 61062: E-Commerce
Tutorial 5 Working with Tables and Columns
Chapter 5 Introduction to XHTML: Part 2
Tutorial 5 Working with Web Tables
New Perspectives on Creating Web Pages with HTML
Табеле Табеле се представљају елементом TABLE.
For the World Wide Web Positioning Objects with CSS
Using HTML Tables SWBAT: - create tables using HTML
Creating Tables in a Web Site
For the World Wide Web Working with Tables in HTML
Site Development Foundations Lesson 6
Principles of Web Design 5th Edition
Presentation transcript:

For the World Wide Web Styling Tables with CSS HTML For the World Wide Web Styling Tables with CSS

Collect Your Files Kyle would like you to add styles to the table to make it more visually attractive. Download the files in the KPAF Styles folder. Save them in the KPAF folder you used to create the schedule web page.

Add Padding to the Table Cells Kyle would like to add more space in each cell by adding 3 pixels of cellspacing and 5 pixels of cellpadding to make the schedule easier to read. Open the schedule.htm file in notepad. Add the following attribute to the opening <table> tag after the border attribute: cellspacing="3" cellpadding="5“ Save your changes and open schedule.htm in your browser. Verify that the spacing in the table has been changed.

Setting the Table Widths & Heights You can use HTML to set the overall width and height of a table and you can also set the width and height of individual cells within a table. To set the width and height of the overall table use the following attribute in the opening <table> tag. <table width="value" height="value"> Where value is any value is in pixels or a percentage.

Setting Column width and Row Heights You can set the width of an individual column by using the width attribute on the <colgroup> element. <colgroup width="value"></colgroup> You can set the height of an individual row by using the height attribute on the <tr> element. <tr height="value"> . . . </tr> Where value is in pixels or percentages

Formmating Table Borders You used the border attribute to create a table border and gridlines when you created the schedule table. The table frame attribute allows several types of borders to be added to a table. Table Frame Border Appearance above Only above the table below Only below the table border Around all four sides of the table box hsides On the top and bottom (horizontal sides) lhs Only on the left side rhs Only on the right side void No border vsides On the left and right (vertical sides)

Table Rules A table rule defines how the internal gridlines are displayed. The rules attribute is used to add a table rule to the <table> element. Table Rule Description all Places gridlines around all table cells cols Places gridlines around the columns groups Places gridlines around row groups none No gridlines rows Places gridlines around rows

Aligning Table Cells Horizontaly To position cell data horizontally, add the align attribute to the <colgroup>, <rowgroup>, or <tr> elements. <tr align="position"> Where position is left, center, right, justify, or char

Aligning Table Cells Vertically To position cell data vertically add the valign attribute to the same elements as the align attribute. <colgroup valign="position"> Where position is top, middle, bottom, or baseline.

Add Cell Positions to the Table Kyle would like the schedule data to be lined up with the top of each cell for the entire table. To do this add the valign attribute to the <tbody>element. <tbody valign="top" > Save your changes and refresh your browser. Verify that the program titles have all moved to the top of the cells.

Formatting Tables with CSS Kyle plans to add additional tables with the morning and afternoon schedules in the future and would like them all to display in the same way. To avoid having to make the format changes on each schedule, he would like you to create a CSS for the table that can be used on all three schedules.

Create a Table CSS Return to the schedule.htm file in notepad. Add a link to the table.css file in the <head> section. <link href="tables.css" rel="stylesheet" type="text/css" /> Because we are going to style the table using the table.css, we do not need the valign attribute in the <tbody> element. Delete it. Add a class attribute to the <table> tag <table border="1" class="schedule" … Save your changes

Add Table Border Styles Open the table.css file in notepad. Add the following style to apply a border to the entire table. table.schedule {border: 10px outset rgb(153, 0, 153)} Add the following style to apply borders to each table cell. table.schedule th, table.schedule td {border: 1px solid grey} These styles only apply to the table belonging to the class=schedule. They will not affect other tables in the site. Save your changes and refresh your browser.

Separate or Collapsed Borders CSS provides two ways of drawing table borders the default is separate borders but you can choose to collapse them using the attribute: border-collapse: type Where type is separate or collapse.

Border Spacing If you choose separate boarders you can also adjust the spacing between them by using the attribute: border-spacing: value Where value is the space between the borders using a CSS units of measure (px, em, %, in)

Collapse the Table Borders Return to the table.css file in notepad. Add the following style to the table element table.schedule {border: 10px outset rgb(153, 0, 153); border-collapse: collapse} Save your changes and refresh your browser. Verify that the table borders have collapsed to a single line between cells.

Apply Styles to Rows & Columns Kyle does not like the font for the table text. He would like to apply a sans-serif font that is 0.7em units in size. He would also like the text in the header row to appear in a white font on a purple background and the first column to appear on a light yellow background. You can use the row and column groups you created to apply these changes.

Levels of Precedence in Table Styles You notice that the first cell is in both the header row and the header column. Which style will be applied? There is a hierarchy of table styles that will determine how conflicts like yours are resolved. In Kyle’s design, the first cell will have a purple background because the row groups take precedence over the columns or column groups, Table Column Group Row Group Rows Table Cells Highest precedence Lowest

Set the Text & Background Table Styles Return to the table.css file in notepad. Add the following styles to the table.schedule declaration: table.schedule {border: 10px outset rgb(153, 0, 153); border- collapse: collapse; font-family: Arial, Helvetica, sans-serif; font- size: 0.7em} Go to the bottom of the style sheet and add the following styles for the table header and first column: table.schedule thead {color: white; background-color: rgb(203, 50, 203)} table.schedule col.firstCol {background-color: rgb(255, 255, 192)} Save your chanes and refresh your browser. Verify that the table text and backgrounds have changed.

Set the Width of the Table Reducing the text size and changing the font made the table more compact. Kyle thinks this makes it hard to read and would like to expand the table to fill the page. To do this add the following attribute to the table.schedule declaration: table.schedule {border: 10px outset rgb(153, 0, 153); border- collapse: collapse; font-family: Arial, Helvetica, sans-serif; font-size: 0.7em; width: 100%} Save your changes and refresh your browser.

Set the Table Column Width Kyle notices that the column widths vary and that the Time column is very small. He would like to make the column width more uniform. To do this add the following style to the firstCol selector: table.schedule col.firstCol {background-color: rgb(255, 255, 192); width: 7%} And add the following style to the bottom of the style sheet: table.schedule col.daycols {width: 7%} Save your changes and refresh your browser.

Set the Row Height Kyle also wants to increase the height of the rows to provide more visual space for the table data elements. To do this add the following style to the bottom of the style sheet: table.schedule thead tr {height: 20px} table.schedule tbody tr {height: 30px} Save your changes and refresh your browser. Verify that the row heights have changed.

Align the Text in the Cells Kyle would like all of the program names to be aligned at the top of the cells. To do this add the following style to the bottom of the style sheet: table.schedule tbody td {vertical-align: top; padding: 5px} Save your changes and refresh your browser. Verify that the cell data is aligned to the top of the cells.

Apply a Caption Style Kyle likes the new table design but he would like the table caption to be aligned in the top-right corner of the table. To do this add the following style to the bottom of the style sheet. caption {caption-style: top; text-align: right} Save your changes refresh your browser.

Turn in your work Upload your KPAF folder to Google Drive When the folder is finished uploading, click on the Share button. Click on Advanced Change the permission from Private to Anyone with the link can view. Copy the link and past it into your Google Docs Journal.