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 centré impossible !


Sujet :

Positionnement en CSS

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    5
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 5
    Points : 3
    Points
    3
    Par défaut Alignement centré impossible !
    bonjour
    notre site a été bâti par un webmaster et bien payé payé mais il ne répond plus... on fait les mises à jour par copié-coller

    on ne peut pas centrer les images, juste les aligner gauche ou droite.
    les commandes habituelles avec Dreamweaver non plus.

    je pense que cela doit être paramétré dans la CSS mais où et comment ? car je n'y ai rien vu de tel :-(

    Alors je tente de suivre les règles du forum, soyez indulgent, moi ma partie c'est QuarkXpress

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
     
    <p><img src="img/cheval.jpg" alt="" class="gauche" />
     
    <p><img src="img/cheval.jpg" alt="" class="droite" />
     
     si je mets  : <p><img src="img/cheval.jpg" alt="" class="centre" /> ça reste à droite 
     
     <p align="center"> ne fonctionne pas

    en vous remerciant ;-)
    Aline

  2. #2
    Modérateur

    Avatar de kOrt3x
    Homme Profil pro
    Technicien Informatique/Webmaster
    Inscrit en
    Septembre 2006
    Messages
    3 650
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Technicien Informatique/Webmaster
    Secteur : Santé

    Informations forums :
    Inscription : Septembre 2006
    Messages : 3 650
    Points : 15 771
    Points
    15 771
    Par défaut
    Salut,

    ça doit se trouver dans un fichier en .css.
    Si tu le trouve, tu peux nous le faire voir.
    La rubrique Mac
    Les cours & tutoriels Mac
    Critiques de Livres Mac & iOS
    FAQ Mac & iOS

    ________________________________________________________________________
    QuickEvent : Prise de rendez-vous rapide pour iPhone/iPad et iPod Touch (AppStore)
    Mon Livre sur AppleScript : AppleScript: L'essentiel du langage et de ses applications

  3. #3
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    5
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 5
    Points : 3
    Points
    3
    Par défaut
    voilà avec tous mes remerciements ;-))))

    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
    body{background-color:#FFEBD2;font:0.8em Arial,Verdana,Helvetica,sans-serif;margin:0;padding:0; background-image:url(img/fond-fonce.png); background-repeat:repeat-x}
    img{border:none}
    a{color:#c1191d; text-decoration: none}
    a:hover{color:black}
     
    /*
    liste numérotée rouge
    */
     
    ol{ 
      color:#CC0000;
    font-size=12px;
    } 
    span{ 
      color:#000000; 
    font-size=16px;
    } 
     
    h1{margin-top:0;padding-top:247px;padding-left:450px;font-family:"Lucida Grande",Tahoma,Helvetica,sans-serif;font-size:2.5em;font-weight:bold;text-transform:uppercase;color:white;display:none}
     
    h2{color:#c1191d;font:1.2em Optima,"Trebuchet MS",Lucida,Arial,Geneva,Verdana,"Lucida Grande",Tahoma,Helvetica,sans-serif;text-transform:uppercase;font-weight: bold; }
     
    h3{font:1.2em Optima,"Trebuchet MS",Lucida,Arial,Geneva,Verdana,"Lucida Grande",Tahoma,Helvetica,sans-serif;clear:both;padding-left:10px;margin-top:30px;background:url(img/degrade-rouge-blanc.png) no-repeat bottom left;padding-bottom:8px;}
     
    h4{margin:0;padding:0}
    p{text-align:justify}
     
    label{float:left;display:inline;width:120px;color:#c1191d}
     
    #langue{position:absolute;float:right;top:235px;right:5px}
    #langue img{margin-right:5px}
    #page{background:url(img/fond_page.png) repeat-y;width:900px;margin: 0 auto}
    #bandeau_haut{
    	background:url(img/bandeau.jpg) 0 10px no-repeat;
    	position:relative;
    	margin-left:auto;
    	margin-right:auto;
    	width:865px;
    	height:295px;
    }
    #colonne_gauche{float:left;width:400px;padding-top:20px;padding-left:32px;padding-bottom:10px}
    #colonne_gauche ul{margin-top:0}
    #colonne_gauche li{margin:0.4em;text-align:justify}
    #colonne_droite{float:right;width:400px;padding-top:20px;padding-right:32px;padding-bottom:10px}
    #colonne_unique{clear:both;width:800px;padding-top:20px;margin-right:50px;margin-left:50px;padding-bottom:10px}
    #colonne_unique p{}
    #bandeau_bas{clear:both;background-color:#eeeeee;height:50px;width:900px;margin-left:auto;margin-right:auto;background:url(img/bas.png) 0px -3px no-repeat}
    #bandeau_bas p{padding-top:15px;font-style:italic;color:#666666;text-align:center}
     
    /* Menu */
    #menuBord{width:840px;border:1px solid #c1191d;margin-left:auto;margin-right:auto;}
    ul#menu{display:table;margin:0 auto;padding:0;}
    #menu li{margin:0;padding:4px 1px 4px 1px;list-style-type:none;}
    #menu a, #menu span{padding:0 10px;border-left:1px solid #c1191d;}
    #menu .first{padding-left:0;border-left:0 none;}
    #menu a{font:11px Verdana,"Lucida Grande",Tahoma,Helvetica,sans-serif;text-transform:uppercase;color:black;text-decoration:none;}
    #menu a:hover{color:#c1191d;text-decoration:none;}
    #menu span{font:11px Verdana,"Lucida Grande",Tahoma,Helvetica,sans-serif;text-transform:uppercase;color:#c1191d}
    #menu li, #menu a, #menu span{float:left;}
    * html ul#menu{text-align:center;display:block;}
    * html #menu li{display:inline-block;float:none;}
     
    /* Colonne de droite */
    #colonne_droite .ombre-haut{width: 100%; height: 3px; background: url(img/ombres/haut.png) no-repeat center top;}
     
    #news{background: url(img/ombres/bas.png) no-repeat center bottom;min-height:172px;margin-top:10px;margin-bottom:10px;margin-left:10px;padding-bottom:3px;font-size:0.95em;}
    #news .contenu{background:url(img/news.png) 0 0 no-repeat;margin-left:3px;min-height: 165px;}
    #news span{font-weight:bold;display:block}
    #news li{list-style-type:none;margin-bottom:0.5em}
    #news ul{margin-top:5px;margin-left:0.5em;padding-left:60px;padding-right:10px}
     
    /*#video{background: url(img/ombres/bas.png) no-repeat center bottom;min-height:135px;margin-left:10px;}*/
    /*#video .contenu{padding:5px 5px 5px 10px;}*/
    /*#video p{margin-top:1px;margin-bottom:3px;margin-left:180px;text-align:left;}*/
    /*#video .sep{clear:both;}*/
     
    #video{background: url(img/ombres/bas.png) no-repeat center bottom;min-height:135px;margin-top:10px;margin-left:10px;}
    #video table {margin: 1px 5px; padding: 0; border: none; border-collapse: collapse; border-spacing: 0;}
    #video table td {padding: 5px; border: none; vertical-align: middle;}
    #video table p{margin:0 0 5px 0; padding: 0;}
     
    #honneur{background: url(img/ombres/bas.png) no-repeat center bottom;min-height:430px;margin-top:10px;margin-bottom:10px;margin-left:10px;padding-bottom:5px;font-size:0.9em;}
    #honneur .contenu{background:url(img/honneur2.png) top right no-repeat; margin:4px;}
    #honneur span{color:#666666;font-size:0.95em}
    #honneur li{list-style-type:none;margin-bottom:2px}
    #honneur ul{background:url(img/lauriers.png) 15px 80px no-repeat;margin-left:0.5em;margin-top:0.3em;padding:0}
     
    #logos{margin-top:10px; margin-left: 10px; font-size:0.95em;}
    #logos div#logo-aa{float: left; width: 65px; margin-left: 10px;}
    #logos div#logo-paypal{float: right; width: 79px; margin-right: 5px}
    #logos div#coordonnees{margin-left: 94px; margin-right: 94px;}
    #logos div#coordonnees p{text-align: left;}
    #logos div#coordonnees span{display:block; color:#c1191d; font:1.15em Optima,"Trebuchet MS",Lucida,Arial,Geneva,Verdana,"Lucida Grande",Tahoma,Helvetica,sans-serif; text-transform:uppercase; font-weight:bold;}
    /* Fin de la colonne de droite */
     
    .article{clear:both;padding-bottom:12px;margin-bottom:25px;border-bottom:1px solid #c1191d}
    .article p{margin-top:8px}
     
    .articleFin{clear:both;padding-bottom:20px;margin-bottom:20px}
    .articleFin p{margin-top:8px}
     
    #videoligne {
    clear: both;
    text-align: justify;
    vertical-align: middle;
    margin-bottom: 30px;
    }
    .gauche{float:left;margin-right:8px;margin-bottom:10px;margin-top:2px;vertical-align: middle}
    .droite{float:right;margin-left:8px;margin-bottom:10px;margin-top:2px;vertical-align: middle}
     
    .centre{width:350px;margin-left:45px;margin-right:auto}
    .politique{font-weight:bold}
    .cadre{margin:10px;border:1px solid #cccccc;padding:10px}
    .bas{text-align:center;color:#c1191d;font-weight:bold;font:1.3em Optima,"Trebuchet MS",Lucida,Arial,Geneva,Verdana,"Lucida Grande",Tahoma,Helvetica,sans-serif}
    .petit{color:#666666;font-size:0.95em}
    .retour{float:right}
    .rouge{color:#c1191d}
    .couv{float:left;margin-left:28px;margin-right:28px;margin-top:20px}
    .couv p{text-align:center;margin-top:0;padding-top:0}
     
    /* Étiquettes de dates*/
    div.data{float:left;width:35px;height:25px;margin:0 2px -5px 0;text-align:center;color:#777;padding-bottom:1px;padding-top:0px;background:#e9f3ff url(img/date.png) no-repeat bottom left}
    div.data span.m{position:relative;top:-2px;text-transform:uppercase;font-size:0.7em}
    div.data span.y{position:relative;top:-7px;font-size:0.8em }
     
    /* Boutique */
    .blocAdhésion{width:100%;overflow:auto;margin-bottom:30px}
    .blocAdhésionGauche{float:left;width:75%}
    .blocAdhésionGauche p{text-align:left;margin:20px}
    .blocAdhésionIllustration{margin-top:30px;float:left;width:25%;text-align:center}
    .blocAdhésion label{display:inline;width:200px;font-weight:bold;margin-left:30px}
    .blocAdhésion span{float:left;display:inline;width:100px}
    .blocAdhésion ul{margin-top:40px;margin-bottom:40px}
    .blocAdhésion li{margin-bottom:15px}
    .blocAdhésion label{display:inline;width:200px;font-weight:bold;margin-left:30px}
    .blocAdhésion span{float:left;display:inline;width:100px};margin-bottom:20px}
     
    .telechargement{overflow:auto;margin-bottom:40px}
    .blocTelechargement{width:100%;overflow:auto;margin-bottom:30px}
     
    .livres{overflow: auto; margin-bottom: 20px; padding-bottom: 30px; background:url(img/barre-rouge-vers-blanc.png) no-repeat center bottom;}
    .blocLivres{width:100%;overflow:auto;margin-bottom:30px;margin-top:30px;}
     
    .accessoires{overflow:auto;margin-bottom:20px;padding-bottom:30px;background:url(img/barre-rouge-vers-blanc.png) no-repeat center bottom;}
    .bloc3Accessoires{float:left;width:33.33%;text-align:center}
    .blocAccessoires{float:left;width:50%;text-align:center}
    .blocAccessoires p{text-align:inherit}
    #formEtiquettesAutocollantes{position:relative;top:23px;}
     
    .tshirts{overflow:auto;margin-bottom:20px;padding-bottom:30px;background:url(img/barre-rouge-vers-blanc.png) no-repeat center bottom;}
    .blocTshirts{float:left;width:50%;text-align:center}
    .blocTshirts p{text-align:inherit}
     
    .frais{overflow:auto;margin-bottom:20px;padding-bottom:30px}
    .fraisDePort{float:left;width:50%;text-align:center}
    .fraisDePort span{font-weight:bold}
     
    .autocollants{overflow:auto;margin-bottom:20px;padding-bottom:30px;background:url(img/barre-rouge-vers-blanc.png) no-repeat center bottom;}
    .blocAutocollants{float:left;width:33.33%;text-align:center}
    .blocAutocollants4{float:left;width:170px;text-align:center}
    .blocAutocollants p{text-align:inherit}
     
    .cartesPostales{overflow:auto;margin-bottom:20px;padding-bottom:30px;background:url(img/barre-rouge-vers-blanc.png) no-repeat center bottom;}
    .blocCartesPostales{float:left;width:33%;text-align:center}
    .blocCartesPostales p{text-align:inherit}
     
    .titre{text-align:center;margin-top:0}
    .illustration{}
    .illustrationBouton{float:left;width:200px;text-align:center;}
    .description{float:right;width:600px}
    .taille{margin-bottom:0;margin-top:5px;text-align:center;}
    .bouton{margin-top:15px;}
    .gris{text-align:center;color:#666666;font-size:0.95em}
    .grisGauche{clear:both;color:#666666;font-size:0.95em}
     
    /* Page adhesion.php */
    div#adhesion label {color: black;}
    div#adhesion div.colonne{float:left; width:50%;}
    div#adhesion fieldset, div#adhesion address {margin-bottom:25px;}
    div#adhesion .legende, div#adhesion div#imprimer a{font-size: medium; font-weight: bold; color: #c1191d;}
    div#adhesion hr{clear:both;}
    div#adhesion .adhesion-type{float:left; width:23%;font-weight:bold;}
    div#adhesion .adhesion-titre{float:left; width:32%; margin-left:10px; font-style:italic;}
    div#adhesion .adhesion-prix{float:left; width:14%; margin-right:10px; text-align:right;}
    div#adhesion .adhesion-nb{float:left; width:13%;}
    div#adhesion .adhesion-total{float:left; width:13%;}
    div#adhesion .sep{clear:both; width:100%; height:25px;}
    div#adhesion .texte-a-droite, div#adhesion .texte-a-droite p{text-align: right;}
    div#adhesion .avertissement {text-align: left; margin-left: 15px;}
    div#adhesion .avertissement li{margin-left: 15px;}
     
    /* Page contact */
    .facteur h3{width:70px;font:1.1em Optima,"Trebuchet MS",Lucida,Arial,Geneva,Verdana,"Lucida Grande",Tahoma,Helvetica,sans-serif;clear:both;color:white;background-color:#c1191d;padding:0;margin-top:30px;text-align:center;}
     
    .fiche{margin-bottom:0px; margin-top:5px; float:left; width:126px; text-align:center;}
    .fiche p{text-align:center;}
    .fiche span{font-style:italic;color:#666666;}
    .fiche-sep{clear:both; width:100%;}
    .avertissement{color:#c1191d;font-weight:bold;font-size:1.1em;border: 2px solid #c1191d; padding: 10px;}
    div#equipe{width:380px; float: right;}
    div#formulaire{width:360px;}
    div#formulaire .espace-haut{margin-top: 40px;}
    div#formulaire ul#formulaire-contact li, div#formulaire form#signer p{margin-bottom: 20px;}
    .input, div#formulaire form#signer textarea{width: 75%;}
    span.legende-nl{visibility: hidden;}
    div#formulaire label{float:none;display:block;}
    div#formulaire ul{margin-left:0;padding-left:0;}
    div#formulaire li{margin-left:15px;padding-left:0;}
     
    /* Page politique */
    li.sans-point {list-style-type: none;}
    .sep{clear:both;}
    #politique-sego table {margin: 0; padding: 0; border: none; border-collapse: collapse; border-spacing: 0;}
    #politique-sego table td {padding: 0px; border: none; vertical-align: middle;}
    #politique-sego table p{margin:0; padding: 0 0 0 8px;}

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2009
    Messages
    81
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2009
    Messages : 81
    Points : 59
    Points
    59
    Par défaut
    Citation Envoyé par alinel Voir le message
    .gauche{float:left;margin-right:8px;margin-bottom:10px;margin-top:2px;vertical-align: middle}

    .droite{float:right;margin-left:8px;margin-bottom:10px;margin-top:2px;vertical-align: middle}
    Salut !

    Selon ces quelques lignes présentes dans ta css, toutes les images ou éléments qui porteront la class ".gauche" seront alignés à gauche à cause du float:left

    Inversement, les éléments portant la class .droite seront alignés à droite à cause du float:right

    Si tu veux qu'une image soit centrée, tu peux créer une autre classe (par exemple .centre). Tu attribue cette classe à l'image que tu veux centrer et dans ta css, tu rajoutes :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    .centre {
    position: relative; 
      margin-left: auto; 
      margin-right: auto; 
      width:la largeur de tes images en px; 
    }

  5. #5
    Candidat au Club
    Profil pro
    Inscrit en
    Mars 2009
    Messages
    5
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2009
    Messages : 5
    Points : 3
    Points
    3
    Par défaut
    Merci beaucoup mais même en utilisant ce script ça aligne toujours à droite

Discussions similaires

  1. Alignement centré non respecté
    Par Denis Placé dans le forum Mise en page CSS
    Réponses: 5
    Dernier message: 14/12/2012, 20h24
  2. Alignement centré avec l’éditeur visuel
    Par byubi dans le forum NetBeans
    Réponses: 1
    Dernier message: 25/01/2011, 12h00
  3. Alignement centre et non pas à gauche
    Par yaya_la_rafale dans le forum AWT/Swing
    Réponses: 5
    Dernier message: 16/12/2010, 09h07
  4. alignement centré-droit latex
    Par motrin dans le forum Mise en forme
    Réponses: 0
    Dernier message: 14/05/2008, 20h26
  5. Problème d'alignement centré
    Par dream_of_australia dans le forum Mise en page CSS
    Réponses: 1
    Dernier message: 09/07/2007, 09h13

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