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 :

margin non pris en compte sous ie7


Sujet :

CSS

  1. #1
    En attente de confirmation mail
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    1 249
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 1 249
    Points : 314
    Points
    314
    Par défaut margin non pris en compte sous ie7
    Bonjour,

    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
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
    <head>
    	<title>SUPERVISION</title>
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
     
    	<style type="text/css">
    body{
    	margin:0;
    	padding:0;
    	background-color:red;}
     
    table{
    	margin:1em auto;
    	padding:0;
    	font-size:0.9em;
    	border-collapse:collapse;
    	border:2px solid #00039e;
    	color:#00039e}
     
    th{
    	font-weight:bold;
    	background-color:#00039e;
    	color:white;
    	font-weight:bold}
     
    th, td{
    	border:1px solid #00039e;
    	text-align:center;
    	padding:0.2em 1em;
    	margin:0}
     
    td{background-color:white}
     
    #zone1{
    	margin:1em;
    	padding:0;
    	background-color:yellow;
    	border:2px solid black;}
     
    	</style>	
    </head>
     
    <body>
    	<div id="zone1">	
    		<table>
    			<thead>
    				<tr>
    				<th colspan="3">AAAAA</th>
    				</tr>
    				<tr>
    				<th>AA</th>
    				<th>AA</th>
    				<th>AA</th>
    				</tr>
    			</thead>
     
    			<tbody>
    				<tr>
    				<td>BB</td>
    				<td id="link0">?</td>
    				<td id="trans0">?</td>
    				</tr>
    				<tr>
    				<td>BB</td>
    				<td>?</td>
    				<td>?</td>
    				</tr>
    				<tr>
    				<td>BB</td>
    				<td>?</td>
    				<td>?</td>
    				</tr>
    				<tr>
    				<td>BB</td>
    				<td>?</td>
    				<td>?</td>
    				</tr>
    			</tbody>
    		</table>
    	</div>
    </body>
    </html>
    => pourquoi le margin (top et bottom) de mon tableau n'est pas pris en compte sous ie7 ?

    Remarque : si je mets mon tableau dans un div avec margin et padding à 0, alors le margin du tableau est pris en compte ... je ne vais quand même pas mettre tous mes tableaux dans des div ????

  2. #2
    Membre émérite Avatar de Erwan31
    Profil pro
    Inscrit en
    Février 2008
    Messages
    2 177
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 2 177
    Points : 2 444
    Points
    2 444
    Par défaut
    Bonjour,
    c'est un problème fréquent de fusion des marges. Ajouter un overflow:hidden #zone1.

  3. #3
    En attente de confirmation mail
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    1 249
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 1 249
    Points : 314
    Points
    314
    Par défaut
    merci pour la réponse : ça marche sous ie7 mais pas sous ie6

    nouvel exemple corrigé :
    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
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
    <head>
    	<title>SUPERVISION</title>
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
     
    	<style type="text/css">
    body{
    	margin:0;
    	padding:1px 0;
    	background-color:white;
    	}
     
    table{
    	margin:1em auto;
    	padding:0;
    	font-size:0.9em;
    	border-collapse:collapse;
    	border:2px solid #00039e;
    	color:#00039e}
     
    th{
    	font-weight:bold;
    	background-color:#00039e;
    	color:white;
    	font-weight:bold}
     
    th, td{
    	border:1px solid #00039e;
    	text-align:center;
    	padding:0.2em 1em;
    	margin:0}
     
    td{background-color:white}
     
    #zone1{
    	margin:0;
    	padding:1em;
    	background-color:red;
    	}
     
    #zone2{
    	overflow:hidden; /*correction de bug : fusion de me marges */
    	margin:0;
    	padding:1px 0; /* ça ne corrige pas les bugs */
    	background-color:yellow;
    	}
     
    	</style>	
    </head>
     
    <body>
    	<div id="zone1">
    		<div id="zone2">	
    			<table>
    				<thead>
    					<tr>
    					<th colspan="3">AAAAA</th>
    					</tr>
    					<tr>
    					<th>AA</th>
    					<th>AA</th>
    					<th>AA</th>
    					</tr>
    				</thead>
     
    				<tbody>
    					<tr>
    					<td>BB</td>
    					<td>?</td>
    					<td>?</td>
    					</tr>
    					<tr>
    					<td>BB</td>
    					<td>?</td>
    					<td>?</td>
    					</tr>
    					<tr>
    					<td>BB</td>
    					<td>?</td>
    					<td>?</td>
    					</tr>
    					<tr>
    					<td>BB</td>
    					<td>?</td>
    					<td>?</td>
    					</tr>
    				</tbody>
    			</table>
    		</div>
    	</div>
    </body>
    </html>
    => j'ai essayé de mettre des padding sur toutes mes zones mais ça ne fonctionne pas

  4. #4
    Membre averti Avatar de rems033
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    513
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Mai 2007
    Messages : 513
    Points : 345
    Points
    345
    Par défaut
    et si tu précise
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    margin-top:0px;margin-bottom:0px;
    ca donne quoi?
    Et tout simplement en rajoutant ???

  5. #5
    Membre émérite
    Avatar de Candygirl
    Femme Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 912
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 51
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 912
    Points : 2 907
    Points
    2 907
    Par défaut
    Citation Envoyé par Emcy Voir le message
    merci pour la réponse : ça marche sous ie7 mais pas sous ie6
    C'est normal l'overflow:hidden ne donne malheureusement pas le layout sur IE6.
    Dans ton cas, un width:100%; pourrait faire l'affaire.
    Les bons réflexes:
    • avant de poser une question:
      règles | faq | tutoriels | recherche
    • clarté, politesse, vocabulaire et orthographe soignés = efficacité
    • remercier ceux qui ont pris le temps d'aider et si c'est le cas

  6. #6
    En attente de confirmation mail
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    1 249
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 1 249
    Points : 314
    Points
    314
    Par défaut
    Citation Envoyé par Candygirl Voir le message
    C'est normal l'overflow:hidden ne donne malheureusement pas le layout sur IE6.
    Dans ton cas, un width:100%; pourrait faire l'affaire.
    merci, effectivement ça marche => c'est vraiment l'anarchie avec tous ces navigateurs ...

    par contre, il y a un truc que je n'ai pas bien compris :
    - si je fais un width:100%; sur zone 1, alors zone 1 prend comme taille la largeur de la page => il y a donc depassement
    - si je fais un width:100%; sur zone 2, alors zone 2 prend comme taille toute la largeur disponible => il n'y a donc pas de dépassement

    => pourquoi ça ne réagit pas de la meme façon ?

  7. #7
    Membre émérite Avatar de Erwan31
    Profil pro
    Inscrit en
    Février 2008
    Messages
    2 177
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2008
    Messages : 2 177
    Points : 2 444
    Points
    2 444
    Par défaut
    Bonjour,
    Pour la zone1 tu as déclaré border:2px solid black ce qui ajoute 4px au 100% de la zone d'affichage donc il y a dépassement.

  8. #8
    En attente de confirmation mail
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    1 249
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 1 249
    Points : 314
    Points
    314
    Par défaut
    Citation Envoyé par Erwan31 Voir le message
    Bonjour,
    Pour la zone1 tu as déclaré border:2px solid black ce qui ajoute 4px au 100% de la zone d'affichage donc il y a dépassement.
    => non, ce n'est pas ça.... de plus je parle de mon deuxième exemple (il n'y a pas de border)...

  9. #9
    Membre émérite
    Avatar de Candygirl
    Femme Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 912
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 51
    Localisation : Suisse

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 912
    Points : 2 907
    Points
    2 907
    Par défaut
    Dans ton 2ème exemple tu as un padding latéral de 1em sur le zone1, d'où le dépassement. Si je t'ai proposé le width 100% sur le zone2 c'est parce qu'il n'avait ni margin ni padding ni border latéraux.
    Les bons réflexes:
    • avant de poser une question:
      règles | faq | tutoriels | recherche
    • clarté, politesse, vocabulaire et orthographe soignés = efficacité
    • remercier ceux qui ont pris le temps d'aider et si c'est le cas

  10. #10
    En attente de confirmation mail
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    1 249
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 1 249
    Points : 314
    Points
    314
    Par défaut
    ok, j'ai compris : merci

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

Discussions similaires

  1. Cookie non pris en compte sous Chrome
    Par Pifon dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 13/12/2014, 19h07
  2. Fichier de VirtualHost non pris en compte sous Apache2
    Par hAz4rd0uS dans le forum Apache
    Réponses: 1
    Dernier message: 15/09/2014, 17h34
  3. Réponses: 1
    Dernier message: 16/03/2010, 10h21
  4. Onmouseover non pris en compte sous FireFox
    Par zouetchou dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 16/10/2008, 09h51
  5. Margin-top non pris en compte sous ff
    Par orphen dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 08/10/2008, 15h42

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