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 :

Alignement gauche et droite


Sujet :

Positionnement en CSS

  1. #1
    Membre régulier
    Homme Profil pro
    Inscrit en
    Janvier 2008
    Messages
    306
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 306
    Points : 106
    Points
    106
    Par défaut Alignement gauche et droite
    Bonjour,

    Dans mon code ci-dessous je n'arrive desesperemment pas à aligner correctement le contenu gauche / droite.

    - Soit je mets float:left, float:right dans quel cas "central" n'apparait plus.
    - soit je mets un positionnement relatif (comme actuellement) et la les deux cadres apparaissent décallés.

    Comment faire pour que "central" apparaisse et que les cadre "cadre_gauhe", "cadre_droit" apparaissent l'un a coté de l'autre ?


    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
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Document sans titre</title>
     
    <style type="text/css">
    body
    	{
    	background-color:grey;	
    	}
    .page
    	{
    	width:980px;
    	height:auto;
    	background-color:white;
    	margin-left:auto;
    	margin-right:auto;
    	}
    .header
    	{
    	border:1px solid black;
    	height:150px;
    	}
    .footer
    	{
    	height:20px;
    	background-color:yellow;
    	text-align:center;
    	border-top:1px dotted black;
    	}
    .central_gauche
    	{
    	position:relative;
    	height:40px;
    	width:300px;
    	border:1px solid black;
    	margin-left::400px;
    	}
    .central_droit
    	{
    	position:relative;
    	margin-left:310px;
    	border:1px solid black;
    	width:660px;
    	}
    .central
    	{
    	height:auto;
    	background-color:pink;
    	}
    </style>
     
    </head>
     
    <body>
     
     
    <div class="page">
     
     
    	<div class="header">
    	Header
        </div>
     
     
        <div class="central">
            <div class="central_gauche">
            Espace gauche
            </div>
     
            <div class="central_droit">
            Espace droit
            </div>
        </div>
     
     
        <div class="footer">
        Footer
        </div>
     
    </div>
     
     
     
    </body>
    </html>
    Quel est encore le problème ?
    Merci d'avance pour votre aide.

  2. #2
    Membre habitué Avatar de Alt157
    Profil pro
    Inscrit en
    Février 2009
    Messages
    143
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 143
    Points : 146
    Points
    146
    Par défaut
    Bonsoir,

    as tu essayé de mettre, sur ton central, un :
    et de mettre ton central gauche en flottant à gauche et ton central droite en flottant à droite ?

    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
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Document sans titre</title>
     
    <style type="text/css">
    body
    	{
    	background-color:grey;	
    	}
    .page
    	{
    	width:980px;
    	height:auto;
    	background-color:white;
    	margin-left:auto;
    	margin-right:auto;
    	}
    .header
    	{
    	border:1px solid black;
    	height:150px;
    	}
    .footer
    	{
    	height:20px;
    	background-color:yellow;
    	text-align:center;
    	border-top:1px dotted black;
    	}
    .central_gauche
    	{
    /*
    * CHANGEMENT ICI
    */
    	float :left;
    	height:40px;
    	width:300px;
    	border:1px solid black;
    	}
    .central_droit
    	{
    /*
    * CHANGEMENT ICI
    */
    	float :right;
    	border:1px solid black;
    	width:660px;
    	}
    .central
    	{
    	height:auto;
    	background-color:pink;
    /*
    * CHANGEMENT ICI
    */
    	overflow : auto;
    	}
    </style>
     
    </head>
     
    <body>
     
     
    <div class="page">
     
     
    	<div class="header">
    	Header
        </div>
     
     
        <div class="central">
            <div class="central_gauche">
            Espace gauche
            </div>
     
            <div class="central_droit">
            Espace droit
            </div>
        </div>
     
     
        <div class="footer">
        Footer
        </div>
     
    </div>
     
     
     
    </body>
    </html>
    Bonne soirée.
    Les filles sont comme les noms de domaines : les meilleures sont déjà prises.

  3. #3
    Membre régulier
    Homme Profil pro
    Inscrit en
    Janvier 2008
    Messages
    306
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 306
    Points : 106
    Points
    106
    Par défaut
    Citation Envoyé par Alt157 Voir le message
    Bonsoir,

    as tu essayé de mettre, sur ton central, un :
    et de mettre ton central gauche en flottant à gauche et ton central droite en flottant à droite ?

    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
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Document sans titre</title>
     
    <style type="text/css">
    body
    	{
    	background-color:grey;	
    	}
    .page
    	{
    	width:980px;
    	height:auto;
    	background-color:white;
    	margin-left:auto;
    	margin-right:auto;
    	}
    .header
    	{
    	border:1px solid black;
    	height:150px;
    	}
    .footer
    	{
    	height:20px;
    	background-color:yellow;
    	text-align:center;
    	border-top:1px dotted black;
    	}
    .central_gauche
    	{
    /*
    * CHANGEMENT ICI
    */
    	float :left;
    	height:40px;
    	width:300px;
    	border:1px solid black;
    	}
    .central_droit
    	{
    /*
    * CHANGEMENT ICI
    */
    	float :right;
    	border:1px solid black;
    	width:660px;
    	}
    .central
    	{
    	height:auto;
    	background-color:pink;
    /*
    * CHANGEMENT ICI
    */
    	overflow : auto;
    	}
    </style>
     
    </head>
     
    <body>
     
     
    <div class="page">
     
     
    	<div class="header">
    	Header
        </div>
     
     
        <div class="central">
            <div class="central_gauche">
            Espace gauche
            </div>
     
            <div class="central_droit">
            Espace droit
            </div>
        </div>
     
     
        <div class="footer">
        Footer
        </div>
     
    </div>
     
     
     
    </body>
    </html>
    Bonne soirée.
    Coucou

    Merci pour ta réponse.
    J'avais deja essayé la solution des float:left - right... mais sans mettre de overflow:auto sur le central et c'est pour ca que l'affichage n'était pas correct.

    J'aurais encore appris quelque chose ce soir :-)
    Merci beaucoup :-)

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

Discussions similaires

  1. texte alignée gauche et droite
    Par armin dans le forum Windows Forms
    Réponses: 7
    Dernier message: 11/06/2009, 11h19
  2. Div en chargement aléatoire + alignement gauche et droite
    Par Prosis dans le forum Mise en page CSS
    Réponses: 6
    Dernier message: 26/05/2009, 17h45
  3. [HTML][CSS] Alignement gauche ET droite dans un <li>
    Par gwendy dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 29/11/2005, 19h27
  4. Aligner à gauche et à droite dans un paragraphe
    Par camboui dans le forum Balisage (X)HTML et validation W3C
    Réponses: 5
    Dernier message: 02/11/2005, 10h36

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