IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Mise en page CSS Discussion :

Aligner plusierus div


Sujet :

Positionnement en CSS

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éprouvé
    Homme Profil pro
    Technophile Web
    Inscrit en
    Mai 2007
    Messages
    930
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Technophile Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2007
    Messages : 930
    Par défaut Aligner plusierus div
    Bonjour,

    J'ai un petit soucis de CSS. Voila, j'ai 3 <div> (menu, sep, content) dans une <div> (body).

    Voici le code CSS pour ma div.body
    Code css : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    div.body
    {
    	background-color: #FFFFFF;
    	height: 100%;
    	width: 975px; 
    	border-right: 7px solid #D2CAC4;
        border-left: 6px solid #D2CAC4;
    }
    voic comment je réalise le design de mes trois div
    Code css : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    div.sep
    {
    	background-image: url('../image/separator/path.jpg');
    	background-repeat: repeat-x;
    	width: 975px; 
    	height: 14px;
    	left: 140px; 
    	border-right: 7px solid #D2CAC4;
        border-left: 6px solid #D2CAC4;
    	top: 0;
    }
    div.menu
    {
    	width: 30%;
    	height: 75px; /** Le problème est ici, c'est moche */
    }
    div.menu ins ul li
    {
    	font-size: 1.2em;
    	line-height: 30px;
    	margin-left: 10px;
    }
    div.content
    {
    	position: relative;
    	left: 25%;
    	width: 75%;
    	top: -75px; /** Le problème est ici */
    }
    mais voila ça passe pas sous IE
    j'ai un petit soucis quand je mets une des trois <div> (sep, content ou menu) en flottant (généralement, float: right, cette dernière passe en dessous du reste des div. J'ai bien essayé de mettre des position: relative, mais en vain.
    Bon okay ma CSS est crade, mais elle fonctionne (sauf deux ou trois trucs) sous IE et FF.
    Voici ma feuille CSS
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    /** Reset CSS default */
    * 
    {
      margin: 0;
      padding: 0;
    }
    html, body, div, span, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,
    del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center,
    dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td 
    {
    	margin: 0;
    	padding: 0;
    	border: 0;
    	outline: 0;
    	font-size: 100%;
    	vertical-align: baseline;
    	background: transparent;
    	background-repeat: no-repeat;
    }
    body 
    {
      line-height: 1;
      font-family: Verdana, Arial, Helvetica, sans-serif;
      color: #FFFFFF;
      font-size: 100%;
      background-color: #FFFFFF;
    }
    h1, h2, h3, h4, h5, h6
    {
     font-weight: normal;
    }
    h1 
    {
    	font-size:2em;
    }
    h2 
    {
    	font-size:1.5em;
    }
    h3 
    {
    	font-size:1em;
    	font-weight:bold;
    }
    small 
    {
    	font-size:0.75em;
    }
    ol, ul 
    {
      list-style: none;
      list-style-type: none;
    }
    blockquote, q 
    {
      quotes: none;
    }
    img 
    {
    	border:0;
    }
    span
    {
    	display: block;
    	margin-top: 0.8em;
    }
    /* remember to define focus styles! */
    :focus 
    {
      outline: 0;
    }
    /* remember to highlight inserts somehow! */
    ins 
    {
      text-decoration: none;
    }
    del 
    {
      text-decoration: line-through;
    }
    /* tables still need 'cellspacing="0"' in the markup */
    table 
    {
      border-collapse: collapse;
      border-spacing: 0;
    }
    sup 
    {
    	position:relative;
    	bottom:0.25em;
    	vertical-align:baseline;
    }
    sub 
    {
    	position:relative;
    	bottom:-0.25em;
    	vertical-align:baseline;
    }
    acronym, abbr 
    {
    	cursor:help;
    	letter-spacing:1px;
    	border-bottom:1px dashed;
    }
    /***** Links *****/
    a, a:link, a:visited, a:hover 
    {
    	text-decoration:underline;
    }
    form 
    {	
    	margin:0;
    	padding: 0;
    	padding:0;
    	display:inline;
    }
    input, select, textarea 
    {
    	font:1em Arial, Helvetica, sans-serif;
    }
    textarea 
    {
    	width:100%;
    	line-height:1.25;
    }
    p
    {
    	display: inline;
    }
    /***** Global Classes *****/
    .clear { clear:both; }
    .float-left { float:left; }
    .float-right { float:right; }
    .text-left { text-align:left; }
    .text-right { text-align:right; }
    .text-center { text-align:center; }
    .text-justify { text-align:justify; }
    .bold { font-weight:bold; }
    .italic { font-style:italic; }
    .underline { border-bottom:1px solid; }
    .highlight { background:#ffc; }
    .wrap { width:960px;margin:0 auto; }
    .img-left { float:left;margin:4px 10px 4px 0; }
    .img-right { float:right;margin:4px 0 4px 10px; }
    .nopadding { padding:0; }
    .noindent { margin-left:0;padding-left:0; }
    .nobullet { list-style:none;list-style-image:none; }
    .indented { margin-left: 8%; }
    /** Skyrecon styles */
    body
    {
    	color: #6E7B88;
    	background-image: url('../image/separator/bg.jpg');
    	background-repeat: repeat;
    	font-size: 12px;
    	margin: auto;
    	width: 988px;
    }
    div.head
    {
    	height: 120px; /** header images height */
    }
    * html div.head
    {
    	margin-bottom: -245px;
    }
    div#header-left
    {
    	background-image: url('../image/header/left.jpg');
    	width: 290px;
    	height: 120px;
    }
    div#header-center
    {
    	position: relative;
    	background-image: url('../image/header/center.jpg');
    	background-repeat: repeat-x;
    	left: 290px; /**  header-left width */
    	top: -120px; /** due to header-left height */
    	width: 528px; /** body - (header-left width + header-right width + this.left) */
    	height: 120px;
    }
    div#header-right
    {
    	position: relative;
    	background-image: url('../image/header/right.jpg');
    	float: right;
    	width: 220px;
    	height: 120px;
    	top: -240px; /** due to header-left and header-center height */
    }
    div.separator
    {
    	background-image: url('../image/separator/path.jpg');
    	background-repeat: repeat-x;
    	width: 975px; /* body.width - margin */
    	height: 14px;
    	left: 140px; /* ??? */
    	border-right: 7px solid #D2CAC4;
        border-left: 6px solid #D2CAC4;
    	top: 0;
    }
    div.message
    {
    	position: absolute;
    	z-index: 1000000;
    	top: 105px;
    	height: 20px;
    	width: 60%;
    	margin-left: 8px; 
    }
    div.body
    {
    	background-color: #FFFFFF;
    	height: 100%;
    	width: 975px; /** body widt - 13 [ margin] */
    	border-right: 7px solid #D2CAC4;
        border-left: 6px solid #D2CAC4;
    }
    div.menu
    {
    	width: 30%;
    	height: 75px; /** dirty, but I'm set off */
    }
    div.menu ins ul li
    {
    	font-size: 1.2em;
    	line-height: 30px;
    	margin-left: 10px;
    }
    div.menu ins ul li:first-child
    {
    	padding-bottom: 50px;
    }
    div.menu ins ul li:last-child
    {
    	padding-top: 50px;
    }
    div.menu ins ul li a
    {
    	text-decoration: none;
    	color: #000000;
    	font-style: italic;
    }
    div.content
    {
    	position: relative;
    	left: 25%;
    	width: 75%;
    	top: -75px; /** dirty, but I'm set off */
    }
    div#footer-left
    {
    	background-image: url('../image/footer/left.jpg');
    	width: 40px;
    	height: 25px;
    }
    div#footer-center
    {
    	position: relative;
    	background-image: url('../image/footer/center.jpg');
    	background-repeat: repeat-x;
    	left: 40px; /**  footer-left width */
    	top: -25px; /** due to footer-left height */
    	width: 947px; /** div.body - div.body.margin - (footer-left width + footer-right width + this.left) */
    	height: 25px;
    }
    div#footer-right
    {
    	position: relative;
    	background-image: url('../image/footer/right.jpg');
    	width: 26px;
    	height: 25px;
    	left: 962px;
    	top: -50px; /** due to footer-left and header-center height */
    }
    auriez vous une idée de comment je peux mettre les drois div en parallele sur la même ligne ?

  2. #2
    Membre expérimenté Avatar de romain_ci
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    262
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Octobre 2007
    Messages : 262
    Par défaut
    oualalala ! c'est vraiment de la bidouille ce que tu nous fait !
    refond ton css... et utilise les float left et right.


    de plus c'est quoi ca ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    html, body, div, span, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,
    del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center,
    dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td 
    {
    	margin: 0;
    	padding: 0;
    	border: 0;
    	outline: 0;
    	font-size: 100%;
    	vertical-align: baseline;
    	background: transparent;
    	background-repeat: no-repeat;
    }
    ca c'est mieu je pence

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    * {
    	margin: 0;
    	padding: 0;
    	border: 0;
    	outline: 0;
    	font-size: 100%;
    	vertical-align: baseline;
    	background: transparent;
    	background-repeat: no-repeat;
    }

  3. #3
    Membre éprouvé
    Homme Profil pro
    Technophile Web
    Inscrit en
    Mai 2007
    Messages
    930
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Technophile Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2007
    Messages : 930
    Par défaut
    Citation Envoyé par romain_ci Voir le message
    oualalala ! c'est vraiment de la bidouille ce que tu nous fait !
    refond ton css... et utilise les float left et right.
    merci de me le dire mais je sais pas ce que tu trouve de la bidouille. je ne dis pas que ma CSS est très bien, mais en tourt cas elle permet d'afficher mon site de la même manière sous IE et FF (enfin quasiment). si tu me trouve quelque chose de mieux je suis preneur
    Citation Envoyé par romain_ci;3443363
    de plus c'est quoi ca ?
    [code
    html, body, div, span, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,
    del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center,
    dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td
    {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
    background-repeat: no-repeat;
    }
    [/code]
    c'est pour initialiser les styles (les navigo ont des CSS par défault, et elles sort toues différentes, il faut donc que je mette des valeurs pour les uniformiser)
    Citation Envoyé par romain_ci Voir le message
    ca c'est mieu je pence
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    * {
    	margin: 0;
    	padding: 0;
    	border: 0;
    	outline: 0;
    	font-size: 100%;
    	vertical-align: baseline;
    	background: transparent;
    	background-repeat: no-repeat;
    }
    selon http://www.christianmontoya.com/2007...-all-the-time/ c'est mal

  4. #4
    Membre expérimenté Avatar de romain_ci
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    262
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Octobre 2007
    Messages : 262
    Par défaut
    Citation Envoyé par sliderman Voir le message
    mais en tourt cas elle permet d'afficher mon site de la même manière sous IE et FF (enfin quasiment).
    Peut etre mais est compatible IE6 ton site ??

    sinon il y a plusieur maniere de faire la chose :

    Avec un float left et un float right
    Ou avec 3 Float left

    Perso je prefere la derniere ! car les float right sous IE6 c'est bien relou !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    <div id='div1'></div>
    <div id='div2'></div>
    <div id='div3'></div>
    css
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    #div1, #div2, #div3 {
                                float:left;
    }
    voila une petite piste

  5. #5
    Membre éprouvé
    Homme Profil pro
    Technophile Web
    Inscrit en
    Mai 2007
    Messages
    930
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Technophile Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2007
    Messages : 930
    Par défaut
    comme je l'ai dis plus haut

    float fait que les div ne sont plus sur la même ligne

    et du cout la hauteur totale de la div qui englobe ces trois div est immense

  6. #6
    Membre éprouvé
    Homme Profil pro
    Technophile Web
    Inscrit en
    Mai 2007
    Messages
    930
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Technophile Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2007
    Messages : 930
    Par défaut
    enfait seul FF (donc le reste des navigo et susceptible de le faire aussi) ne m'afficher pas la div parente des trois div lorsque je l'a méttait en float.

    j'ai donc utilisé une overflow: hidden; et tout est rentré das l'ordre

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [CSS] align verti div dans td
    Par speedev dans le forum Mise en page CSS
    Réponses: 6
    Dernier message: 14/08/2006, 20h47
  2. [css]alignement de div.
    Par luta dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 07/07/2006, 01h36
  3. [CSS] Alignement de div
    Par irenee dans le forum Mise en page CSS
    Réponses: 3
    Dernier message: 04/05/2006, 22h36
  4. [Débutant] Aligner deux divs sur une ligne avec inline
    Par Braz dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 09/03/2006, 10h52
  5. [CSS]Aligner les div suivant la résolutation d'écran
    Par nebule dans le forum Mise en page CSS
    Réponses: 4
    Dernier message: 09/09/2005, 11h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo