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 :

Quel positionnement utiliser pour des divs


Sujet :

Positionnement en CSS

  1. #1
    Débutant
    Inscrit en
    Mars 2009
    Messages
    201
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 201
    Points : 62
    Points
    62
    Par défaut Quel positionnement utiliser pour des divs
    bonjour,
    je suis entrain de faire mon premier site avec css et j'essaie d'utiliser les div
    j'utilise la proprieté absolute pour que je puisse déplacer les divs,
    voici mon code
    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
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    body{
    	margin:20px 0;
    	padding:0;
    	background:url(../img/bodyBg.gif);
    	font:12px Arial, Helvetica, sans-serif;
    }
    #page{
    	width:1004px;
    	overflow:hidden;
    	margin:0px 20px;
     
    }
    #header{
    	width:100%;
    }
     
    #header div.partieg{
        width:254px;
        height:193px;
    	overflow:hidden;
        position:absolute;
        top:10px;
        left:28px;
        background:url(../img/homme_gauche.jpg) top left no-repeat;
    }
    #header div.sigle{
    	width:475px;
    	height:152px;
    	overflow:hidden;
    	position:absolute;
    	background:url(../img/sigle_middle3.jpg) top center no-repeat;
    	left: 282px;
    	top: 10px;
    	background-color:#FFFFFF;
     
    }
    #header div.partied{
    	width:244px;
    	height:193px;
    	overflow:hidden;
    	position:absolute;
    	background:url(../img/homme_droite.jpg);
    	left: 757px;
    	top: 10px;
    }
     
    /* ---------------------- Redslate nav ---------------------- */
    #header div.red #slatenav{
    	position:absolute;
    	display:block;
    	height:45px;
    	width:607px;
    	font-size:11px;
    	font-weight:bold;
    	background:transparent url(../img/redslate_background.gif) repeat-x top left;
    	font-family:Arial,Verdana,Helvitica,sans-serif;
    	text-transform:uppercase;
    	overflow:hidden;
    	left: 283px;
    	top: 162px;
    }
    #header div.red #slatenav ul{margin:0px;padding:0;list-style-type:none;width:auto;}
    #header div.red #slatenav ul li{display:block;float:left;margin:0 1px 0 0;}
    #header div.red #slatenav ul li a{display:block;float:left;color:#FECCC3;text-decoration:none;padding:14px 33px 0 33px;
    height:28px;}
    #header div.red #slatenav ul li a:hover,.red #slatenav ul li a.current{color:#fff;background:transparent url(../img/redslate_backgroundOVER.gif) no-repeat top center;}
    /* ---------------------- END Redslate nav ---------------------- */
     
    #main{
    	width:100%;
    	overflow:hidden;
    }
    #main div#leftCol{
    	width:180px;
    	padding:10px;
    	overflow:hidden;
    	float:left;
     
    }
    #main div#leftCol div#login{
    	width:205px;
    	overflow:hidden;
    }
    #main div#leftCol div#login div.logTop{
    	height:6px;
    	width:206px;
    	overflow:hidden;
    	background:url(../img/loginBorderTop.gif) no-repeat;
    	position:absolute;
    	top:228px;
    	left:28px;
    }
    #main div#leftCol div#login div.logBottom{
    	height:6px;
    	width:205px;
    	overflow:hidden;
    	background:url(../img/loginBorderBottom.gif) no-repeat;
    	position:absolute;
    	top:424px;
    	left:28px;
    }
    #main div#leftCol div#login div.logMain{
    	width:185px;
    	height:484px;
    	padding:0 10px;
    	background:url(../img/loginBg.gif) repeat-x;
    	position:absolute;
    	top:234px;
    	left:28px;
    }
    #main div#leftCol div#login div.logMain div.logTitle{
    	color:#FFF;
    	padding:4px 40px;
    	font:16px Arial, Helvetica, sans-serif bold;
    }
    #main div#leftCol div#login div.logMain form{
    	display:block;
    	overflow:hidden;
    }
    #main div#leftCol div#login div.logMain form div.line{
    	overflow:hidden;
    	text-align:left;
    	font:11px Arial, Helvetica, sans-serif;
    }
    #main div#leftCol div#login div.logMain form div.line div.label{
    	width:100px;
    	color:#FFF;
    	text-align:left;
    	padding:10px 0 0 0;
    	margin:0 5px 0 0;
    	overflow:hidden;
    }
    #main div#mainCol{
    	width:730px;
    	padding:10px;
    	float:left;
    	top:228px;
    	left:252px;
    	position:absolute;
    	height: 465px;
    	overflow: scroll;	
    }
    #main div.coinlefttop{
     
    	width:19px;
    	height:23px;
    	background:url(../img/coin1.png) no-repeat;
    	position:absolute;
    	left: 367px;
    	top: 226px;
    }
    #main div.cadrleft{
    	width:19px;
    	height:23px;
    	background:url(../img/traitcadre1.png) repeat-y;
    	position:absolute;
    	left: 495px;
    	top: 224px;	
    }
    #main div.cadrright{
    	width:19px;
    	height:23px;
    	background:url(../img/traitcadre.png) repeat-y;
    	position:absolute;
    	left:387px;
    	top:220px;	
    }
    #main div.cadrbottom{
        width:766px;
    	height:25px;
    	background:url(../img/cadrbottom.png) no-repeat;
    	position:absolute;
    	left: 367px;
    	top: 651px;
    }
    #main div#leftCol div.marque{
     
    	width:205px;
    	height:271px;
    	top:444px;
    	position:absolute;
    	left: 28px;
    }
    #page div.footer{
    	width:975px;
    	height:31px;
    	position:absolute;
    	background:url(../img/footer.jpg) no-repeat;
    	left: 30px;
    	top: 738px;
    	text-align:center;
    	text-decoration:underline;
    	font:Verdana large bolder lighter;
    	color:#FFFFFF;
    	padding:5px 0px 0px 0px;
    }
    #main div#mainCol div.mainTitle{
    	padding:5px 0 5px 10px;
    	color:#67695c;
    	font:14px Arial, Helvetica, sans-serif;
    }
    #main div#mainCol div.form form div.line1 input.field{
    	display:block;
    	width:59%;
    	height:20px;
    	float:left;
    	padding:6px 5px 3px 25px;
    	color:#333;
    	overflow:hidden;
    	border:1px solid #FFCCCC;
    	font:12px Arial, Helvetica, sans-serif;
    }
    #main div#mainCol div.form form div.line1{
    	position:relative;
    	text-align:left;
    	overflow:hidden;
    	padding:7px 0;
    }
    #main div#mainCol div.form form div.line1 div.label1{
    	height:19px;
    	width:25%;
    	float:left;
    	padding:2px 0 0 0;
    	margin:0 3% 0 0;
    	overflow:hidden;
    	color:#333;
    	text-align:right;
    	font:bold 11px Arial, Helvetica, sans-serif;
    }
    #main div#mainCol div.form form div.linesubmit{
    	position:relative;
    	text-align:center;
    	overflow:hidden;
    	padding:20px 0;
    }
    #main div#mainCol div.form form div.line1 textarea#message{
    	display:block;
    	width:59%;
    	height:200px;
    	float:left;
    	padding:6px 5px 3px 25px;
    	color:#333;
    	overflow:auto;
    	border:1px solid #FFCCCC;
    	font:12px Arial, Helvetica, sans-serif;
    	background:#fff url(../img/form_note.gif) no-repeat 5px 6px;
    }
    #main div#mainCol div.form form div.line1 input#name{background:#fff url(../img/form_name.gif) no-repeat 5px 50%;}
    #main div#mainCol div.form form div.line1 input#email{background:#fff url(../img/form_email.gif) no-repeat 5px 50%;}
    #main div#mainCol div.form form div.line1 input#objet{background:#fff url(../img/icone_sujet.gif) no-repeat 5px 50%;}
     
    #leftCol div.marque ul.vert-one{margin:0;padding:0;list-style-type:none;display:block;font:bold 16px Helvetica, Verdana, Arial, sans-serif;line-height:165%;width:205px;}
    #leftCol div.marque ul.vert-one li{margin:0;padding:0;border-top:1px solid #CC3333;border-bottom:1px solid #761A1A;}
    #leftCol div.marque ul.vert-one li a{display:block;text-decoration:none;color:#fff;background:#CC3333;padding:0 0 0 20px;width:185px;}
    #leftCol div.marque ul.vert-one li a:hover{background:#FF3333 url("../img/vert-one_arrow.gif") no-repeat 0 9px;}
    #leftCol div.marque ul.vert-one li a.current,ul.vert-one li a.current:hover{background:#FF3333 url("../img/vert-one_arrow.gif") no-repeat 0 9px;}
     
    #main div.connect{
    	text-decoration:underline;
    	position:absolute;
    	left: 355px;
    	top: 135px;
    	font:14px Arial, Helvetica, sans-serif bold;
    	color:#FF0000;
    	width: 304px;
    }
    #main div.deconnect{
    	position:absolute;
    	left: 492px;
    	top: 19px;
    	width: 121px;
    	text-decoration:underline;
     
    	}
    .Style1 {
    	font-size: 18px;
    	font-weight: bold;
    	color: #666666;
    }
    #menu{
    	width:205px;
    	margin:0px;
    }
    .menu, .sousmenu{
    	text-align:center;
    }
    .menu{
    	height:20px;
    	width:205px;
    	padding:1px 0;
    	background:#CC9999;
    	color:#fff;
    }
    .sousmenu{
    	height:18px;
    	width:205px;
    	padding:1px 0;
    	background:#CCCCCC;
    	color:#fff;
    }
    .menu a{
    	display:block;
    	width:100%;
    	height:100%;
    	color:#fff;
    	font-family:arial,sans-serif;
    	font-size:12px;
    	font-weight:bold;
    	text-decoration:none;
    	background:#CCCCCC;
    }
    .sousmenu a{
    	display:block;
    	width:100%;
    	height:100%;
    	color:#fff;
    	font-family:arial,sans-serif;
    	font-size:12px;
    	font-weight:bold;
    	text-decoration:none;
    	background:#CC9999;
    }
    .menu a:hover, .sousmenu a:hover, .menu a:active, .sousmenu a:active, .menu a:focus, .sousmenu a:focus{
    	background:#ca0008;
    }
    .top{
    background-image:url('../img/top.gif');
    background-repeat:repeat-x;
    height:100%;
    width:100%;
    }
    .bottom{
    background-image:url('../img/bottom.gif');
    background-repeat:repeat-x;
    background-position:bottom;
    height:100%;
    width:100%;
    }
    .left{
    background-image:url(../img/left.gif);
    background-repeat:repeat-y;
    height:100%;
    width:100%;
    }
    .right{
    background-image:url('../img/right.gif');
    background-repeat:repeat-y;
    background-position:right;
    height:100%;
    width:100%;
    }
    .topLeft{
    background-image:url('../img/topLeft.gif');
    background-repeat:no-repeat;
    height:100%;
    width:100%;
    }
    .topRight{
    background-image:url('../img/topRight.gif');
    background-repeat:no-repeat;
    background-position:top right;
    height:100%;
    width:100%;
    }
    .bottomLeft{
    background-image:url('../img/bottomLeft.gif');
    background-repeat:no-repeat;
    background-position:bottom left;
    height:100%;
    width:100%;
    }
    .bottomRight{
    background-image:url('../img/bottomRight.gif');
    background-repeat:no-repeat;
    background-position:bottom right;
    height:100%;
    width:100%;
    }
    .cadre{
     
    width:207px;
    height:271px;
    }
    .posrelative
    {
    POSITION: relative;
    }
    #conteneur
    {
    OVERFLOW: hidden;
    WIDTH: 205px;
    CLIP: rect(0px 250px 250px 0px);
    POSITION: absolute;
    LEFT: 2px;
    TOP: 15px;
    }
    mais cette méthode dépend de l'écran que j'utilise, mais ce site va etre héberger donc il doit etre compatible pour chaque type d'écran.
    alors ya til une autre méthode pour posisionner les divs comme j'espère
    svp, votre aide, merci pour ceux qui lisent mon message long

  2. #2
    Expert éminent
    Avatar de 12monkeys
    Homme Profil pro
    Webmaster
    Inscrit en
    Novembre 2006
    Messages
    4 093
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : Webmaster
    Secteur : Service public

    Informations forums :
    Inscription : Novembre 2006
    Messages : 4 093
    Points : 9 031
    Points
    9 031
    Par défaut
    Bonsoir

    Utiliser une position absolute partout n'est pas l'idéal en effet...

    Tu peut lire ce tutoriel : http://pbnaigeon.developpez.com/tuto...e-en-page-CSS/

    Utilises toutes les possibilités : le positionnement naturel (dans le flux), les float, le positionnement relatif, et éventuellement le positionnement absolute.

    Si tu veux garder ton positionnement absolute tu peux inclure ton site dans un div en position relative avec une largeur fixe, les éléments en position absolute se trouvant à l'intérieur vont se positionner en fonction de ce conteneur.
    Vous souhaitez participer à la rubrique (X)HTML/CSS, contactez moi.
    débutez avec les CSS
    Pas de MP pour des questions techniques ! Mode d'emploi du forum ; Règles ; Pensez à la balise code ; Pas de SMS !
    Votez pour les messages qui vous ont aidés...

Discussions similaires

  1. Quel type utiliser pour des données serialized?
    Par Nalexx dans le forum Requêtes
    Réponses: 3
    Dernier message: 03/12/2012, 01h15
  2. Réponses: 3
    Dernier message: 24/01/2007, 10h26
  3. Réponses: 1
    Dernier message: 04/01/2006, 14h39
  4. Quel langage utiliser pour des formulaires ?
    Par le_ben dans le forum Langages de programmation
    Réponses: 19
    Dernier message: 13/10/2005, 14h08
  5. quel outil utiliser pour defragmenter des TB ?
    Par falafel23 dans le forum Autres Logiciels
    Réponses: 2
    Dernier message: 12/09/2005, 22h20

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