28220 sujets

CSS et mise en forme, CSS3

Bonjour,
J'ai un petit soucis sous FF. En fait, j'ai un bloc principal que je redimensionne selon la résolution de l'utilisateur. Dans ce bloc principal j'ai plusieurs petit bloc dont le bloc contenu. J'aimerais que ce dernier s'agrandisse avec le changement de la résolution et qu'il y ai qu'une petite marge entre le bloc principal et lui. Ce n'est pas le cas ... Le bloc principal devient plus petit que le bloc contenu Smiley bawling . Par contre sous IE aucun soucis.
Je vous mets mon code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
   <head>
      <title>Accueil</title>
   </head>
   <style>
   
   	html, body
	{
		height: 100%;	
	}
	
	body {
		font-family: Verdana, Arial, Helvetica, sans-serif;
		font-size: 62.5%;
		margin: 0;
		padding: 0;
		height: 100%
	}
	
	h1, h2, h3, h4, h5, h6 {
		font-family: Arial,sans-serif;
		margin: 0px;
		padding: 0px;
	}
	
	h1{
	 font-family: Arial, Helvetica, sans-serif;
	 font-size:2em;
	}
	
	h3{
		font-size:1.25em;
		letter-spacing: 1px;
		font-weight: normal;
	}
	
	#conteneur {
		position: absolute;
		width: 100%;
		height: 100%;
	}
	
	#blocEntete
	{
		margin: 0;
		padding: 9px 0px 0px;
		height: 35px;
		border: 1px solid black;
	}
	
	#menuGauche {
    position: absolute;
    left:0;
	width: 120px;
    margin-left: 5px;
    margin-right: 3px;
	}
	
	.communPrincipal{
		text-align: justify;
		padding-left: 7px;
		margin-bottom: 7px;
		margin-top: 0px;
		margin-right: 0px;
		margin-left: 0px;
		padding-top: 3px;
		padding-right: 7px;
		padding-bottom: 3px;
		-moz-border-radius: 6px;
		border-radius: 6px;
		border: 1px solid black;
	}
	
	#blocPrincipal {
		margin-left: 128px;
		margin-right: 125px;
		padding-top: 2px;
		padding-bottom: 2px;
		padding-left: 2px;
		padding-right: 2px;
		border: 1px solid red;
		height: 74%;
	}
	
	#blocErreur h3
	{
		height: 1.3em;
	}
	
	#blocContenu{
		text-align: justify;
		letter-spacing: 1px;
		vertical-align: text-top;
		margin-top: 0px;
		margin-bottom: 7px;
		padding-top: 10px;
		padding-bottom: 3px;
		height: 85%;
	}
	
	html>body #blocContenu {
		height: auto;
		min-height: 85%;
	}
	
	#blocBasPage
	{
		bottom: 10px;
		font-size:0.9em;
		text-align: right;
		letter-spacing: 1px;
		margin-bottom: 0px;
	}
   </style>
   <body>
	<div id="conteneur">
		<div id="blocEntete"> 
			<h1>Titre</h1>  
		</div>
		<div id="menuGauche">	
			<h3>Menu</h3>
		</div>
				
		<div id="blocPrincipal">
			<div id="blocTitre" class="communPrincipal">
				<h3>Accueil</h3>
			</div>	
	
			<div id="blocErreur" class="communPrincipal">
				<h3></h3>
			</div>	
				
			<div id="blocContenu" class="communPrincipal">
				Bloc contenu
			</div>	
						
			<div id="blocBasPage" class="communPrincipal"> 
				<h3>Bas de page</h3>	
			</div> 
		</div>
	</div>
   </body>
</html>

Je ne sais pas comment résoudre ce problème. Si quelqu'un pouvait me donner un coup de pouce.
Merci.
ps: désolée mais je n arrive pas à indenter.
Modifié par Akei (19 Aug 2005 - 22:39)
bonjour

je n'ai pas compris ce que tu cherches à obtenir mais si tu veux coder en xhtml strict, le code est plutôt celui-çi :


<?xml version="1.0" encoding="iso-8859-1"?>
<!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-FR" lang="fr-FR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="fr-FR" dir="ltr" />
<title>Accueil</title>

<style type="text/css">
/*<![CDATA[*/
html, body
{
height: 100%;
}
body
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 62.5%;
margin: 0;
padding: 0;
height: 100%
}

h1, h2, h3, h4, h5, h6 {
font-family: Arial,sans-serif;
margin: 0;
padding: 0;
}

h1{
font-family: Arial, Helvetica, sans-serif;
font-size:2em;
}

h3{
font-size:1.25em;
letter-spacing: 1px;
font-weight: normal;
}

#conteneur {
position: absolute;
width: 100%;
height: 100%;
}

#blocEntete
{
margin: 0;
padding: 9px 0 0;
height: 35px;
border: 1px solid black;
}

#menuGauche {
position: absolute;
left:0;
width: 120px;
margin-left: 5px;
margin-right: 3px;
}

.communPrincipal{
text-align: justify;
padding-left: 7px;
margin-bottom: 7px;
margin-top: 0;
margin-right: 0;
margin-left: 0;
padding-top: 3px;
padding-right: 7px;
padding-bottom: 3px;
-moz-border-radius: 6px;
border-radius: 6px;
border: 1px solid black;
}

#blocPrincipal {
margin-left: 128px;
margin-right: 125px;
padding-top: 2px;
padding-bottom: 2px;
padding-left: 2px;
padding-right: 2px;
border: 1px solid red;
height: 74%;
}

#blocErreur h3
{
height: 1.3em;
}

#blocContenu{
text-align: justify;
letter-spacing: 1px;
vertical-align: text-top;
margin-top: 0;
margin-bottom: 7px;
padding-top: 10px;
padding-bottom: 3px;
height: 85%;
}

html>body #blocContenu {
height: auto;
min-height: 85%;
}

#blocBasPage
{
bottom: 10px;
font-size:0.9em;
text-align: right;
letter-spacing: 1px;
margin-bottom: 0;
/*]]>*/
</style>
</head>
<body>
<div id="conteneur">
<div id="blocEntete">
<h1>Titre</h1>
</div>
<div id="menuGauche">
<h3>Menu</h3>
</div>

<div id="blocPrincipal">
<div id="blocTitre" class="communPrincipal">
<h3>Accueil</h3>
</div>

<div id="blocErreur" class="communPrincipal">
<h3></h3>
</div>

<div id="blocContenu" class="communPrincipal">
Bloc contenu
</div>

<div id="blocBasPage" class="communPrincipal">
<h3>Bas de page</h3>
</div>
</div>
</div>
</body>
</html>


si tu utilises les id des divs pour tes explications je testerais plus avant.à première vue, les déclarations body,html sont en conflit.

de plus, tu utilises du code propriétaire géko! j'espére au moins que tu ne fais pas partir de ces "crieurs au loup"...

si çà peux t'aider, voilà ce que me dit top stylepro.

CSS Level 2 (2 errors, 0 warnings)
Selector Description
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.


Internet Explorer 5 Mac (4 errors, 0 warnings)
Selector Description
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.
html>body #blocContenu Property min-height does not exist in this definition.
#blocBasPage Property bottom does not exist in this definition.


Internet Explorer 5.5 (4 errors, 0 warnings)
Selector Description
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.
html>body #blocContenu Child selectors aren't supported by this style definition.
html>body #blocContenu Property min-height does not exist in this definition.


Internet Explorer 5 (5 errors, 0 warnings)
Selector Description
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.
html>body #blocContenu Child selectors aren't supported by this style definition.
html>body #blocContenu Property min-height does not exist in this definition.
#blocBasPage Property bottom does not exist in this definition.


Internet Explorer 6 (3 errors, 0 warnings)
Selector Description
html, body In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
body In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
#conteneur In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
#conteneur In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
#blocEntete In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
#menuGauche In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.
#blocPrincipal In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
#blocErreur h3 In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
#blocContenu In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
html>body #blocContenu Child selectors aren't supported by this style definition.
html>body #blocContenu In MSIE 6, height and width are calculated differently depending on whether standards-compliant mode is enabled.
html>body #blocContenu The property "min-height" only applies to TD, TH and TR elements in fixed-layout tables.


Konqueror 2.2 Linux (8 errors, 0 warnings)
Selector Description
h3 Property letter-spacing does not exist in this definition.
.communPrincipal justify is not a valid value for text-align
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.
#blocContenu justify is not a valid value for text-align
#blocContenu Property letter-spacing does not exist in this definition.
html>body #blocContenu Property min-height does not exist in this definition.
#blocBasPage Property letter-spacing does not exist in this definition.


Netscape 7 (6 errors, 0 warnings)
Selector Description
html, body 100% is not a valid value for height
body 100% is not a valid value for height
#conteneur 100% is not a valid value for height
.communPrincipal Property border-radius does not exist in this definition.
#blocPrincipal 74% is not a valid value for height
#blocContenu 85% is not a valid value for height


Opera 5 and 6 (2 errors, 0 warnings)
Selector Description
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.


Opera 7 (2 errors, 0 warnings)
Selector Description
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.


Safari 1.0 (3 errors, 0 warnings)
Selector Description
.communPrincipal Invalid property. The character "-" should not precede the property name.
.communPrincipal Property border-radius does not exist in this definition.
html>body #blocContenu Property min-height does not exist in this definition.

il y à du boulôt pour un site internavigateur, bonne chance.
une petite chose, la section cdata est très peu supportée.utilise plutôt une feuille externe.c'est plus sur.
Smiley ohwell Oulala
Tout d abord merci pour ta réponse.
Pour la fonction de mozilla c'etait juste un test que je n appliquerais pas, j'ai trouvé une autre solution en utilisant juste les css.
Sinon il y a des choses qui ne sont pas très claire encore. En fait si j 'utilise des %, il faut que je les utilise partout ou je peux utiliser des pixels?

Mon problème est que sous FF le cadre (rouge) du blocPrincipal ne reste pas en dessous de mon blocBasPage. En fait ce que j'aimerais c'est avoir mon blocPrincipal qui s'agrandit en fonction de la résolution de l'utilisateur. Seulement il ne se comporte pas de la meme facon sous IE et FF.
J'aimerais avoir le blocTitre, blocErreur, blocBasPage a une hauteur fixe. Et donc il n'y aurait que le blocContenu qui s'agrandirait en fonction du blocPrincipal.

J'espère que j'ai été assez claire Smiley smile

Sinon pour html>body #blocContenu comment faut il que je fasse alors?
Parce que j'ai lu que pour règler le problème du min-height avec IE il fallait appliquer ca pour les autres navigateurs (du moins ce que j'ai compris).
Merci
+
Modifié par Akei (24 Aug 2005 - 01:59)
bonjour

ok, je vois tout çà ce soir.

les pourcentages doivent s'apliquer aux conteneurs et les pixels aux blocs à l'intérieur des conteneurs.

min-height peut se régler sans hacks.je vais tester tout çà.
Bonjour,
On va dire que j'ai à peu pres résolu mon problème.
Le hic maintenant c'est le hack du min-height.
En tout cas c'est beaucoup plus clair avec les %. Smiley biggrin
merci.
Pour information,
Comment tu vois les erreurs de mon CSS avec les différents navigateurs?
Parce que lorsque je valide mon fichier CSS avec W3C, il m'indique aucune erreur donc comment je peux savoir.
Merci
++
slt

a écrit :
c'est beaucoup plus clair avec les %.


y à pas photo! pour ce type de mise en place il n'y à pas mieux.

a écrit :
Parce que lorsque je valide mon fichier CSS avec W3C, il m'indique aucune erreur


çà n'empêche pas les conflits et les interprétations érronées ou fantaisistes.ce que valide le w3c c'est la syntaxe.

a écrit :
donc comment je peux savoir


l'expérience pallie les manques.elle permet aussi de savoir que, par exemple, les liens sont à définir, selon le w3c, selon la syntaxe suivante

link, visited, hover, active

ok! mais çà ne fonctionne pas avec tout les navigateurs.ie5/6, par exemple, préfére

link, visited, active, hover

et ce n'est qu'un exemple, il en existe beaucoup d'autres du même genre.

les tests et la lecture sont incontournables.pour la lecture, eric meyer est lui aussi incontournable, ces bouquins sont des pépites.jason cranford teague à également écrit de très bons ouvrages.raphaél vient aussi de sortir un bouquin sur le sujet mais je ne l'ai pas lu.

pour les tests, installe autant de navigateurs que possible.perso, j'en ai sept.ie5, ie6(si,si c'est possible), netscape7, firefox, mozilla, amaya et opera(permet aussi d'émuler un navigateur mode texte comme linx).
pour la validation, des logiciels comme valideXhtml ou topstyle version pro sont excellent.valideXhtml est gratuit mais pas topstyle.l'extension de firefox, webdevelloper est également géniale.pour les tests de résolutions, browser-sizer est sympà.

je vais essayer de te trouver une solution sans min-height.à mon avis çà réglera ce problème de décallage et éliminera ce vilain hack.