Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [xhtml] tabelka ze scrollem
Forum PHP.pl > Forum > Po stronie przeglądarki > HTML \ XHTML
FiDO
Chce sobie zrobic tabelke ze scrollem, ale tak, ze pierwszy wiersz (naglowek z nazwami kolumn) nie jest scrollowany (zawsze widoczny), a jedynie pozostale. Zalozenie jest takie, ze kazda kolumna ma z gory okreslony rozmiar (w pixelach). I teraz jak takie cos zrobic? :/

Jedyne co wymeczyłem to:
- zrobienie tabelki, która jest nagłówkiem (jednowierszowej) o tych zadanych szerokościach kolumn,
- pod spodem tabelka z danymi w div'ie (div ma styl "overflow: auto" co powoduje dodanie scrolla)

Niestety scroll jest wtedy dodawany na zewnatrz tabelki, co ja poszerza o iles tam pixeli (zalezy jak kto ma szerokosc scrolla ustawioną w systemie), a tabelka gorna (naglowek) ma byc szeroka tak jak ta dolna + szerokość scrolla... Zamieszalem? smile.gif

Chodzi o coś takiego
Teraz mam ustawioną szerokość nagłówka na stałe, jak zmienie szerokość scrolla w systemie to już nie będzie działać, a chce zrobić to uniwersalnie (ma działać conajmniej na IE i Mozilli winksmiley.jpg )
Skrócenie nagłówka o szerokość scrolla nie widzi mi się specjalnie, bo jak widać lub nie... pod tabelką jest dodatkowa tabela z białym tłem i miałbym w rogu biały prostokąt.
gulldarek
Mam nadzieję, że dobrze cię zrozumiałem i o to chodzi.

Acha i nie zwracaj uwagi na brak znacząych elementów html'a bo robiłem to na szybko smile.gif

[xml:1:7d4d6cb52a]<html>
<head>

<style type="text/css">
<!--
.header {background:#6780B8; font-family:arial,sans-serif; font-size:9pt; color:#FFFFFF; height:19px;}

.table1 {background:#CDCDBE; font-family:arial,sans-serif; font-size:9pt; height:19px;}
.table2 {background:#EBEAD8; font-family:arial,sans-serif; font-size:8pt; color:#965136; height:16px;}
.table3 {background:#F5F4E7; font-family:arial,sans-serif; font-size:8pt; height:16px;}
.table4 {background:#EBEAD8; font-family:arial,sans-serif; font-size:8pt; height:16px;}
.table5 {background:#F5F4E7; font-family:arial,sans-serif; font-size:9pt; color:#55554B; height:19px;}
.table6 {background:#EBEAD8; font-family:arial,sans-serif; font-size:9pt; color:#55554B; height:19px;}
.table7 {background:#F5F4E7; font-family:arial,sans-serif; font-size:9pt; height:19px;}
.table8 {background:#EBEAD8; font-family:arial,sans-serif; font-size:9pt; height:19px;}

#tableheader1 { position: relative; top:0px; left: 0px; z-index:53; visibility: visible}
#columnheader1 { position: relative; top:-1px; z-index:52; visibility: visible}
#tablebody1 { position: relative; top:-2px; left: 0px; z-index:51; visibility: visible}
-->
</style>

</head>

<div id="tableheader1">
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#6780b8">
<tr height="1">
<td bgcolor="#4f556a" height="1" colspan="3"><img src="spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td bgcolor="#4f556a" width="1"><img src="spacer.gif" width="1" height="1"></td>
<td>
<table width="604" border="0" cellpadding="0" cellspacing="0" align="left">
<tr height="19">
<TD nowrap></TD>
<td class="header" nowrap height="19">&nbsp;&nbsp;Wyniki czegos tam, exclusive for FiDO</td>
<td class="header" width="100%" height="19"></td>
</tr>
</table>
</td>
<td bgcolor="#4f556a" width="1"><img src="spacer.gif" width="1" height="1"></td>
</tr>
<tr height="1">
<td bgcolor="#4f556a" height="1" colspan="3"><img src="spacer.gif" width="1" height="1"></td>
</tr>
</table>
</div>
<!-- table header end -->
<div id="columnheader1" style="width:600">
<table bgcolor="#4F556A" border=0 cellspacing=0 cellpadding=0>
<tr>
<td>
<table border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="table1" width="100" nowrap>&nbsp;&nbsp;Pos</td>
<td class="table1" width="200" nowrap>&nbsp;&nbsp;Nick</td>
<td class="table1" width="150" nowrap>&nbsp;&nbsp;Punkty</td>
<td class="table1" width="135" nowrap>&nbsp;&nbsp;Bilans</td>
<td class="table1"><img src="spacer.gif" width="15" height="1"></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div id="tablebody1" style="overflow:auto; height:100; width:606; border-bottom-style:solid; border-bottom-color:#4F556A; border-bottom-width:1">
<table bgcolor="#4F556A" border=0 cellspacing=0 cellpadding=0>
<tr>
<td>
<table class="text" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="table5" width="100" nowrap>&nbsp;&nbsp;1</td>
<td class="table5" width="200" nowrap>&nbsp;&nbsp;gulldarek</td>
<td class="table5" width="150" nowrap>&nbsp;&nbsp;999999999999</td>
<td class="table5" width="135" nowrap>&nbsp;&nbsp;564565645646756</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;2</td>
<td class="table5" nowrap>&nbsp;&nbsp;FiDO</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645646</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;3</td>
<td class="table5" nowrap>&nbsp;&nbsp;gulldi</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;4</td>
<td class="table5" nowrap>&nbsp;&nbsp;itd.</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;5</td>
<td class="table5" nowrap>&nbsp;&nbsp;itp.</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;6</td>
<td class="table5" nowrap>&nbsp;&nbsp;etc.</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;7</td>
<td class="table5" nowrap>&nbsp;&nbsp;cos</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;8</td>
<td class="table5" nowrap>&nbsp;&nbsp;drugie cos</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;9</td>
<td class="table5" nowrap>&nbsp;&nbsp;trzecie cos</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645</td>
</tr>
<tr>
<td class="table5" nowrap>&nbsp;&nbsp;10</td>
<td class="table5" nowrap>&nbsp;&nbsp;ostatnie cos</td>
<td class="table5" nowrap>&nbsp;&nbsp;999999</td>
<td class="table5" nowrap>&nbsp;&nbsp;564565645</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</html>[/xml:1:7d4d6cb52a]
FiDO
Pieknie 8)
O to wlasnie mi chodzilo... zabieram sie za analize kodu ;]
gulldarek
Mam nadzieje, ze sie przydalo, a swoja droga ja tez z tego skorzystam smile.gif
Dominik
Zgodnie ze standardami bedzie tak:
[xml:1:8ca385ab40]<table>
<thead>
<tr>
<td>a<td>
<td>b<td>
<td>c<td>
<td>d<td>
</tr>
</thead>

<tbody style="overflow: auto; height: 50px; border: 1px solid black">
<tr>
<td>1<td>
<td>2<td>
<td>3<td>
<td>4<td>
</tr>
<tr>
<td>1<td>
<td>2<td>
<td>3<td>
<td>4<td>
</tr>
<tr>
<td>1<td>
<td>2<td>
<td>3<td>
<td>4<td>
</tr>
<tr>
<td>1<td>
<td>2<td>
<td>3<td>
<td>4<td>
</tr>
<tr>
<td>1<td>
<td>2<td>
<td>3<td>
<td>4<td>
</tr>
<tr>
<td>1<td>
<td>2<td>
<td>3<td>
<td>4<td>
</tr>
<tbody>
</table>[/xml:1:8ca385ab40]
gulldarek
Nie wiem jak u FiDO ale u mnie to nie dziala....
Dominik
Cytat
Nie wiem jak u FiDO ale u mnie to nie dziala....

Powiedzialem zgodnie ze standardami a nie zgodnie z IE biggrin.gif
To dziala na Gecko (Mozilla, Firefox, K-meleon, Galeon, NEtscape itp), chyba na Operze 7, na Konq (czyli rowniez na Safari).
Teodor
Cytat
Zgodnie ze standardami bedzie tak:
[xml:1:43377c3efa]<table>
<thead>
<tr>

[...]

<td>4<td>
</tr>
<tbody>
</table>[/xml:1:43377c3efa]

Wlasnie chcialem cos identycznego wrzucic tongue.gif

Dla IE moze byc cos takiego: -> demo http://quake2.org/temp/table_ie.html
[xml:1:43377c3efa]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=iso-8859-2" http-equiv="Content-type" />
<meta content="pl" http-equiv="Content-Language" />
<style type="text/css">
body {
background-color: white;
margin: 0px;
padding: 0px;
}
#maindiv {
height: 200px;
width: 600px;
overflow: auto;
margin: 0px;
padding: 0px;
border: 0px;
}
td {
width: 150px;
background: silver;
border: 1px dashed white;
border-spacing: 0px;
}
table {
margin: 0px;
padding: 0px;
border: 0px;
border-spacing: 0px;
}
tr {
margin: 0px;
padding: 0px;
}
.tabmain {
width: 600px;
border: 0px;
}
</style>
<title>Tabelka w divie smile.gif</title>
</head>
<body>
<table class="tabmain" cellspacing="0">
<tr>
<td>H 1</td>
<td>H 2</td>
<td>H 3</td>
<td>H 4</td>
</tr>
<tr>
<td colspan="4">
<div id="maindiv">
<table class="tabmain" cellspacing="0">
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
<tr>
<td>POZ 1</td>
<td>POZ 2</td>
<td>POZ 3</td>
<td>POZ 4</td>
</tr>
</table>
</div>
</td>
</tr>
</table>

</body>
</html>[/xml:1:43377c3efa]

Pozdrawiam
FiDO
I tak tylko pierwsza odpowiedz zaspokoila moje potrzeby co do wygladu tej tabelki, a dostosowanie jej do xhtml'a to bylo pare minut winksmiley.jpg
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.