[CSS] DIV's gaan onder elkaar ipv naast elkaar

Pagina: 1
Acties:

  • Reveller
  • Registratie: Augustus 2002
  • Laatst online: 05-12-2022
Ik probeer een site te bouwen waar ik voor het eerst tables vervang door css elementen. Nu heb ik het volgende probleem:
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
42
43
44
45
<style>
#body {
    width: 650px;
    margin-left: 15px;
    margin-top: 20px;
    padding: 0px;
}

#leftnav {
    width: 150px;
    padding: 0px;
    float: left;
    background: #cccccc;
}

#main {
    width: 500px;
    float: left;
    padding: 0px;
    background: lime;
}

#main #leftcol {
    width: 200px;
    padding: 0px;
    background: blue;
}

#main #rightcol {
    width: 500px;
    float: right;
    padding: 0px;
    background: red;
}
</style>

<div id="body">
  <div id="leftnav">hoi</div>
  <div id="main">Lorem ipsum dolor sit amet, consectetur 
    adipisicing elit, sed do eiusmod tempor incididunt 
    ut labore et dolore magna aliqua.
    <div id="leftcol">foto</div>
    <div id="rightcol">beschrijving</div>
  </div>
</div>


Dit ziet er in de browser als volgt uit:
Afbeeldingslocatie: http://www.danandan.luna.nl/css1.jpg

Waarom ziet het er niet zo (ff ge-photoshopped) uit?
Afbeeldingslocatie: http://www.danandan.luna.nl/css2.jpg

"Real software engineers work from 9 to 5, because that is the way the job is described in the formal spec. Working late would feel like using an undocumented external procedure."


  • coubertin119
  • Registratie: Augustus 2002
  • Laatst online: 25-05 19:01
200px + 500px == 700px, de parent is 500px breed.

Trek je conclusies :).

Skat! Skat! Skat!


  • Reveller
  • Registratie: Augustus 2002
  • Laatst online: 05-12-2022
@coubertin119: heb het aangepast, maar nu ziet het er zo uit:

Afbeeldingslocatie: http://www.danandan.luna.nl/css3.jpg

Waarom staat de rode <div> niet op dezelfde hoogte als de blauwe?

[ Voor 4% gewijzigd door Reveller op 08-04-2004 21:54 ]

"Real software engineers work from 9 to 5, because that is the way the job is described in the formal spec. Working late would feel like using an undocumented external procedure."


  • Genoil
  • Registratie: Maart 2000
  • Laatst online: 12-11-2023
allebeit float:left maken, toch?

  • Reveller
  • Registratie: Augustus 2002
  • Laatst online: 05-12-2022
@Genoil: idd ja... dank je! :)

"Real software engineers work from 9 to 5, because that is the way the job is described in the formal spec. Working late would feel like using an undocumented external procedure."