Tabuľky.

Slides:



Advertisements
Similar presentations
Using HTML Tables Presenting Information & Layout Control.
Advertisements

HTML Tables Introduction to Tables Introduction to Tables Table Format Table Format Table Captions Table Captions Table Example Table Example Excercise.
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything Text Lists Other tables Pictures …
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 6: HTML Tables.
HTML TABLES Cyndi Hageman. Tables   Attributes Name or id – used to identify the table Border = set this to determine if there is a border and the size.
1 Tables: Data in Rows and Columns – What is Table? – How Tables are Used? – Designing Tables – Table, Cell, Row Attributes – Using Tables for Alignment.
Tables And Lists. Slide 2 Lecture Overview Learn about the basics of tables Create simple 2-dimensional tables Format tables Create tables with complex.
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.
Images and Tables. Displaying Image Attributes: SRC= " mypic.gif " – Name of the picture file SRC= " pic/mygif.jpg " – Name of file found in pic directory.
Notes Ch. 12—Creating Tables Web Page Design. Why Use Tables? Tables are used to create a variety of items such as calendars, charts, and spreadsheets.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 06: Tables - Spring 2011.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorial 5: Working with Tables.
Lecture: Tables. Table Tags (all container tags) establishes a table (________) establishes a row (________) says what’s in the row more than one TD within.
1 eVenzia Technologies Learning HTML, XHTML & CSS Chapter 2.
HTML B OOT C AMP Chapter 10 Tables Kirkwood Continuing Education © Copyright 2015, Fred McClurg All Rights Reserved.
Technologies for web publishing Ing. Václav Freylich Lecture 3.
Introducing Web Tables. Tables for tabulating items  Better looking  More flexibility  More efficient to explain information than plain text.
A table is a rectangular arrangement of rows and columns on your screen A table is used to organize data into rows and columns and also increasingly.
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.
Tables Web Authoring. This kind of a table THISIs aTABLE THISIs aTABLE THISIs aTABLE THISIs aTABLE.
 2003 Prentice Hall, Inc. All rights reserved. Introduction to HTML: Tables Outline 1 Introduction 2 Basic HTML Tables 3 Intermediate HTML Tables and.
Computer Science 101 Lists and Tables. Lists Unordered lists - use a bullet Ordered lists - use a number, Roman numeral, or letter.
CS-3432 Electronic Commerce Lecture – 7 Sikandar Shujah Toor
1 Tables attributes. 2 Table attributes: border Activates border around cells Syntax: – where “n” is a value in pixels which controls the “thickness”
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.
Unit 4 Create and Use Tables. TITLE CORNELL NOTES TOPIC: NOTES: Name: Date: 09/08/2009 Period : Summary: Reasons for using tables Unit 4 Page 1 Display.
TABLES IN HTML No, not that kind of table!! THIS KIND!!
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Web Development & Design Foundations with HTML5
Yourfriendmanoj.wordpress.com Fb/yourfriendmanoj
Week 6 Creating Tables using HTML.
H T M L A B E S X P I N D.
>> HTML: Tables.
Web Development & Design Foundations with HTML5 8th Edition
Getting Started – Table 2
HTML Tables CS 1150 Spring 2017.
HTML Tables.
Programming the Web using XHTML and JavaScript
Introduction to HTML.
H T M L A B E S X P I N D.
TABLES.
HTML Tables CS 1150 Fall 2016.
8 Tables.
Creating Tables Steps for creating a Table Important Facts about Table
Табеле Табеле се представљају елементом TABLE.
HTML/XML HTML Authoring.
Table CSS Create a new CSS called tablestyle.CSS Green Background
Integritné obmedzenia v SQL
Creating Tables Steps for creating a Table Important Facts about Table
TABLES.
LESSON Extension Module 2: HTML Basics Tables.
TABLES IN HTML No, not that kind of table!! THIS KIND!!
Web Design and Development
Creating Tables in HTML
Creating Tables in HTML
Web Development & Design Foundations with H T M L 5
HTML Tables & Frames Internet Technology.
COMS 161 Introduction to Computing
Single Tags <tagName> Example: <BR>
Web Development & Design Foundations with HTML5
H T M L A B E S X P I N D.
Site Development Foundations Lesson 6
Creating Tables Steps for creating a Table Important Facts about Table
Lesson 5: HTML Tables.
H T M L A B E S X P I N D.
Hypertext Markup Language Table 11th Lecture
Web Development & Design Foundations with HTML5
HTML Tables & Frames Internet Technology.
Basics of Web Design Chapter 9 Table Basics Key Concepts
Presentation transcript:

Tabuľky

Teória :) Tabuľky sa skladajú z buniek, ktoré sú umiestnené do riadkov a stĺpcov V jazyku HTML je preto potrebné rozlíšiť, nie len to, kde sa začína a končí tabuľka ale aj to, kde sa začína a končí riadok tabuľky a aké bunky do daného riadku patria

Značky Základnou značkou pre vytvorenie tabuľky je značka <table>...</table> Ako sme si už spomínali, tabuľka sa skladá z riadkov, ktoré sa vkladajú značkou <tr>...</tr> V riadkoch sa nachádzajú bunky, ktoré vkladáme značkou <td>...</td> Špeciálnym typom buniek sú hlavičkové bunky <th>...</th>

Preklad značiek (z angličtiny) table – tabuľka tr (table row) – riadok tabuľky td (table data cell) – údajová bunka v tabuľke th (table header cell) – hlavička bunka v tabuľke

Príklad tabuľky 2x2 <table> <tr> <td>Ľavá horná</td> <td>Pravá horná</td> </tr> <td>Ľavá dolná</td> <td>Pravá dolná</td> </table> Ak neveríte, že je text v tabuľke, stlačte Ctrl+A, čím sa vyberie celý obsah stránky:

Atribúty tagu <table> border="1" – hrúbka rámčeka align="center" – nastavenie zarovnania tabuľky (left-vľavo, right-vpravo, center – v strede) cellpadding="1" – vnútorný okraj bunky (vzdialenosť textu od okraja bunky) cellspacing="1" – vonkajší okraj bunky (vzájomná vzdialenosť buniek tabuľky) widht, height – šírka a výška bunky (podobne ako u obrázkov sa môže zadávať buď ako bezrozmerné číslo – rozmer bude v pixeloch, alebo ako číslo so znakom percento – tabuľka sa roztiahne na x% zo stránky)

Atribút border <table border="1"> <tr> <td>Ľavá horná</td> <td>Pravá horná</td> </tr> <td>Ľavá dolná</td> <td>Pravá dolná</td> </table> Takto bude vyzerať tabuľka s atribútom border nastaveným na hodnotu 20: Poznámka: Od tejto chvíle atribút border nebudem uvádzať, ale tabuľku budem pre názornosť zobrazovať ako orámovanú

Atribút align <table align="center"> <tr> <td>Ľavá horná</td> <td>Pravá horná</td> </tr> <td>Ľavá dolná</td> <td>Pravá dolná</td> </table> center left right

Atribút cellpadding <table cellpadding="0"> <tr> <td>Ľavá horná</td> <td>Pravá horná</td> </tr> <td>Ľavá dolná</td> <td>Pravá dolná</td> </table> 10 20

Atribút cellspacing <table cellspacing="0"> <tr> <td>Ľavá horná</td> <td>Pravá horná</td> </tr> <td>Ľavá dolná</td> <td>Pravá dolná</td> </table> 10 20

Atribút width <table width="350"> <tr> <td>Ľavá horná</td> <td>Pravá horná</td> </tr> <td>Ľavá dolná</td> <td>Pravá dolná</td> </table> Takto bude vyzerať tabuľka s atribútom width nastaveným na hodnotu 100%:

Atribút height <table height="250"> <tr> <td>Ľavá horná</td> <td>Pravá horná</td> </tr> <td>Ľavá dolná</td> <td>Pravá dolná</td> </table> Takto bude vyzerať tabuľka s atribútom height nastaveným na hodnotu 100%:

Atribúty tagu <td> a <th> align="center" – nastavenie vodorovného (horizontálneho) zarovnania obsahu bunky (left-vľavo, right-vpravo, center – v strede) valign="center" – nastavenie zvislého (vertikálneho) zarovnania obsahu bunky (top-hore, bottom-dole, middle-v strede) widht, height – šírka a výška bunky (podobne ako u obrázkov sa môže zadávať buď ako bezrozmerné číslo – rozmer bude v pixeloch, alebo ako číslo so znakom percento – tabuľka sa roztiahne na x% zo stránky) colspan="2" – spojenie buniek horizontálne (číslo udáva počet spojených stĺpcov v riadku) rowspan="2" – spojenie buniek vertikálne (číslo udáva počet spojených riadkov v stĺpci)

Atribúty align a valgin <table> <tr> <td align="left" valign="top">A</td> <td align="center" valign="top">B</td> <td align="right" valign="top">C</td> </tr> <td align="left" valign="middle">P</td> <td align="center" valign="middle">Q</td> <td align="right" valign="middle">R</td> <td align="left" valign="bottom">X</td> <td align="center" valign="bottom">Y</td> <td align="right" valign="bottom">Z</td> </table>

Atribút width <table> <tr> <td width="10%">A</td> <td width="30%">B</td> <td width="60%">C</td> </tr> <td>P</td> <td>Q</td> <td>R</td> <td>X</td> <td>Y</td> <td>Z</td> </table>

Atribút height <table> <tr> <td height="10%">A</td> <td>B</td> <td>C</td> </tr> <td height="30%">P</td> <td>Q</td> <td>R</td> <td height="60%">X</td> <td>Y</td> <td>Z</td> </table> Tu som trošku zmenšil veľkosť písma, aby bolo vidno zmeny výšky buniek pri zmene hodnôt atribútu height

Atribút colspan <table> <tr> <td colspan="2">AB</td> <td>C</td> </tr> <td>P</td> <td>Q</td> <td>R</td> <td>X</td> <td colspan="2">YZ</td> </table>

Atribút rowspan <table> <tr> <td rowspan="2">AP</td> <td>B</td> <td>C</td> </tr> <td>Q</td> <td rowspan="2">RZ</td> <td>X</td> <td>Y</td> </table>

Pozor na počty buniek Ak používate atribúty colspan a rowspan, tak ich píšeme vždy do tej bunky, kde chceme spájanie začať (pre colspan v ľavej bunke, pre rowspan v hornej bunke) Ak ste mali v pôvodnej tabuľke v riadku 5 buniek a 2 z nich chcete spojiť atribútom colspan, výsledný počet buniek v riadku bude 4 (1 veľká spojená + 3 malé nespojené) a teda v riadku potom musí byť <td>...</td> už len 4-krát Podobne to platí aj pre spájanie atribútom rowspan a teda musíte v ďalších riadkoch odobrať príslušný počet buniek Ak na to zabudnete, tabuľky budú vyzerať takto:

„Zabudnuté“ bunky X X <tr> <td colspan="2">A</td> <td>B</td> <td>C</td> </tr> <td>P</td> <td>Q</td> <td>R</td> <td>X</td> <td>Y</td> <td>Z</td> <tr> <td rowspan="2">A</td> <td>B</td> <td>C</td> </tr> <td>P</td> <td>Q</td> <td>R</td> <td>X</td> <td>Y</td> <td>Z</td>

Zvláštnosti width a height Ak atribúty width a height nezadáte, prehliadač prispôsobí šírky a výšky jednotlivých buniek ich obsahu Ak máme napr. trojstĺpcovú tabuľku a atribút width zadáme len do dvoch stĺpcov, šírka tretieho stĺpca sa automaticky dopočíta Atribút width stačí nastaviť len v prvej bunke stĺpca – ostatné bunky v stĺpci sa tejto voľbe prispôsobia Atribút height stačí nastaviť len v prvej bunke riadku – ostatné bunky v riadku budú túto voľbu akceptovať Súčet percentuálnych hodnôt šírok/výšok by nemal presiahnuť 100%, inak sa rozmery tabuľky budú správať „zvláštne“

Ďalšie atribúty Značky <table>, <td> a <th> majú aj ďalšie atribúty Nakoľko budú ďalšie hodiny venované štúdiu jazyka kaskádových štýlov (CSS), rozhodol som sa ich neuvádzať, aby sa vám na neskorších hodinách nemiešali vlastnosti v HTML s vlastnosťami v CSS Ďalšie atribúty pre tabuľky a bunky si ale môžete nájsť na stránke JakPsatWeb.cz