[HTML/CSS] Positionering tabel

Pagina: 1
Acties:
  • 110 views sinds 30-01-2008
  • Reageer

  • Roeligan
  • Registratie: December 2001
  • Laatst online: 22-07-2025
Ik heb nu een pagina welke in het midden van het scherm gepositioneerd moet worden. Hij centreerd de pagina wel, echter alleen horizontaal en niet verticaal. Volgens mij is mijn HMTL en CSS wel goed, iemand een idee?

Pagina (met beetje ColdFusion)
HTML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Sol Y Casa nagel &amp; zonnestudio</title>
    <link rel="stylesheet" href="common/style.css" type="text/css">
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</head>
<cfoutput>
<cfset bgColor="9cd4ea, fda11d, 8aee47">
<body bgcolor="#listGetAt(bgColor, randRange(1, listLen(bgColor)))#">
<table class="screen" cellpadding="0" cellspacing="0">
    <tr class="header">
        <td></td>
    </tr>
    <tr>
        <td><cfinclude template="dsp_menu.cfm"></td>
    </tr>
    <tr class="main">
        <td>
            #fusebox.layout#
        </td>
    </tr>
    <tr class="footer">
        <td>
            Sol Y Casa nagel &amp; zonnestudio | Created by <a href="http://www.leftlane.nl" target="_blank">LeftLane Internet Industries</a>
        </td>
    </tr>
</table>

</body>
</cfoutput>
</html>


En de CSS (is een css welke ik vaker gebruik, er staat nogal wat meuk in ;))
Cascading Stylesheet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
body
        {
        width: 100%;
        margin-left: auto;
        margin-right: auto;
        margin-top: 0px;
        margin-bottom: 0px;
        text-align: center;
        vertical-align: middle;
        font-family: Verdana;
        font-size: 10pt;
        }

a:link, a:visited, a:active
        {
        color: #000000;
        text-decoration: none;
        }
a:hover
        {
        font-weight: bold;
        }
td
        {
        font-size: 10pt;
        font-family: Verdana;
        }
input, select, textarea
        {
        font-size: 8pt;
        font-family: Verdana;
        background-color: #BBBBBB;
        border-collapse: collapse;
        border-style: solid;
        border-width: 1px;
        border-color: #000000;
        }   

/*  Workspace (commonly based on 800*600 resolution)    */
.screen
        {
        background-color: #d5e1f4;
        text-align: center;
        vertical-align: middle;
        height: 600px;
        width: 800px;
        margin-left: auto;
        margin-right: auto;
        margin-top: 0px;
        margin-bottom: 0px;
        border-collapse: collapse;
        border-style: solid;
        border-width: 1px;
        border-color: #000000;
        font-size: 10pt;
        }

.header
        {
        height: 100px;
        background-color: #BBBBBB;
        background-repeat: no-repeat;
        background-image: url(../img/header.jpg);
        }

.footer
        {
        height: 15px;
        background-color: #9cd4ea;
        font-size: 8pt;
        color: #000000;
        }

.menu
        {
        height: 20px;
        background-color: #9cd4ea;
        padding: 0px;
        }
a.menu:link, a.menu:visited, a.menu:active
        {
        text-decoration: none;
        color: #FFFFFF;
        }
a.menu:hover
        {
        font-weight: bold;
        }

.modules
        {
        width: 200px;
        text-align: center;
        vertical-align: top;
        }

.main
        {
        vertical-align: top;
        text-align: left;
        font-size: 10pt;
        width: 500;
        }

.error
        {
        color: #FF0000;
        }
        
.container
        {
        margin-left: auto;
        margin-right: auto;
        width: 580px;
        background-color: #AEBBD9;
        border-style: solid;
        border-color: #8297C1;
        border-width: 1px;
        border-collapse: collapse;
        vertical-align: top;
        }
        
.containerHeader
        {
        background-color: #42639C;
        background-repeat: no-repeat;
        background-position: right; 
        background-image: url(../img/interface/header.png);
        color: #FFFFFF;
        font-weight: bold;
        }
        
/*  Normal text */
.text
        {
        font-size: 10pt;
        width: 95%;
        border-collapse: collapse;
        }
        
.textHeader
        {
        padding-left: 5px;
        background-color: #154A9A;
        font-size: 10pt;
        font-weight: bold;
        color: #FFFFFF;
        }

/*  Lists of data (eg. overview created from DB)    */
.list
        {
        font-size: 10pt;
        border-collapse: collapse;
        }

.listHeader
        {
        font-size: 10pt;
        font-weight: bold;
        }

/*  listrows (commonly produced in cfoutput)    */
.odd
        {
        font-size: 10pt;
        background-color: #B5B7AF;
        }
.even
        {
        font-size: 10pt;
        background-color: #D6D7D3;
        }

.oddLink
        {
        font-size: 10pt;
        background-color: #B5B7AF;
        cursor: pointer;
        }
.evenLink
        {
        font-size: 10pt;
        background-color: #D6D7D3;
        cursor: pointer;
        }

/*  spacers for tables and other usefull stuff  */
.height5
        {
        height: 5px;
        }

.height10
        {
        height: 10px;
        }

.height25
        {
        height: 25px;
        }

.spacer5
        {
        width: 5px;
        }
        
.spacer10
        {
        width: 10px;
        }
        
.pointer
        {
        cursor: pointer;
        }
.help
        {
        cursor: help;
        }

[ Voor 15% gewijzigd door Roeligan op 29-08-2005 20:10 ]

A real man fears not mortality for it's death, he fears mortality for it's lack of life!
RatPack #814


  • Roeligan
  • Registratie: December 2001
  • Laatst online: 22-07-2025
Ik heb nu een tabel eromheen gezet met in de class 100% height en width met 1 row, 1 cell en daarin de andere tabel genest. Class ook een text-align: center en vertical-align: middel gegeven alsmede alle margins op auto.

A real man fears not mortality for it's death, he fears mortality for it's lack of life!
RatPack #814


  • Willem
  • Registratie: Februari 2001
  • Laatst online: 01-05 10:40
Post de relevante code eens? Die krijg je door te gaan debuggen, en 'onzin' weg te laten. Zo laat je ons onterecht zoeken naar een speld in een hooiberg. Zo vreselijk moeilijk is het centreren van een tabel namelijk niet :)

Motor onderhoud bijhouden


  • Roeligan
  • Registratie: December 2001
  • Laatst online: 22-07-2025
Zoals gezegd heb ik om de tabel die in het voorbeeld boven staat een andere tabel gegooid:

HTML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Sol Y Casa nagel &amp; zonnestudio</title>
    <link rel="stylesheet" href="common/style.css" type="text/css">
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</head>
<cfoutput>
<cfset bgColor="9cd4ea, fda11d, 8aee47">
<body bgcolor="#listGetAt(bgColor, randRange(1, listLen(bgColor)))#">

<table class="god">
    <tr>
        <td>
    
<table class="screen" cellpadding="0" cellspacing="0">
    <tr class="header">
        <td></td>
    </tr>
    <tr>
        <td><cfinclude template="dsp_menu.cfm"></td>
    </tr>
    <tr class="main">
        <td>
            #fusebox.layout#
        </td>
    </tr>
    <tr class="footer">
        <td>
            Sol Y Casa nagel &amp; zonnestudio | Created by <a href="http://www.leftlane.nl" target="_blank">LeftLane Internet Industries</a>
        </td>
    </tr>
</table>

        </td>
    </tr>
</table>

</body>
</cfoutput>
</html>


In de css het volgende toegevoegd:
Cascading Stylesheet:
1
2
3
4
5
6
7
8
9
10
11
.god
        {
        height: 100%;
        width: 100;
        text-align: center;
        vertical-align: middle; 
        margin-left: auto;
        margin-right: auto;
        margin-top: auto;
        margin-bottom: auto;
        }

A real man fears not mortality for it's death, he fears mortality for it's lack of life!
RatPack #814