Problema CSS con IE 6

In questo Forum potrete chiedere consigli (ma anche condividere le vostre conoscenze) sulla progettazione e realizzazione di siti. Scoprite con le nostre Muse i segreti del web design... e perché nessuno va a vedere quella paginetta che vi è costata tanta fatica. Html, xhtml, xml, css, php, asp, js, flash e tutto quel che ci gira attorno.

Moderatori: Supervisor, Moderatori Software e Programmazione

IZ5IOW
Mortale devoto
Mortale devoto
Messaggi: 5
Iscritto il: 15 ago 2009 09:43

Problema CSS con IE 6

Messaggio da IZ5IOW »

Salve a tutti !!

Penso che sia la sezione corretta per questa domanda...altrimenti mi scuso in anticipo dell'errore.

Volevo sapere gentilmente come risolvere un problema: dopo aver realizzato un sito web personale utilizzando i fogli di stile (CSS) ho notato che quando apro le pagine con IE 6 mi trovo davanti tutti i vari "elementi" spostati (come elementi intendo: header, container, footer, ecc...). In poche parole non vengono visualizzati correttamente.

Ho provato con altri Browser (come ad esempio Firefox, Chrome ed Opera) e il problema non esiste, visualizzo le pagine tranquillamente senza cambiamenti, senza spostamenti vari e senza problemi in generale...

Ho già avuto altri tipi di problemi con IE6, ad esempio la "brutta" :D visualizzazione delle immagini con esetnsione .png. Fortunatamente ho risolto inserendo uno script (trovato in questo forum) nell' head dell'html.

Vorrei sapere se esistono metodi oppure degli script per risolvere anche il problema del CSS.

Grazie in anticipo per le vostre risposte, vi auguro una buona giornata a tutti.
Avatar utente
freemind
Supervisor sezione Programmazione
Supervisor sezione Programmazione
Messaggi: 4643
Iscritto il: 04 apr 2007 19:28

Messaggio da freemind »

Ciao.
Il posto è giusto per postare la tua domanda!

Potresti postare il codice del tuo css così proviamo a guardarlo?

Ciao
IZ5IOW
Mortale devoto
Mortale devoto
Messaggi: 5
Iscritto il: 15 ago 2009 09:43

Messaggio da IZ5IOW »

Ciao freemind !

Grazie della risposta, ecco il codice:

Codice: Seleziona tutto

#body {
	background-color: #FFF;
	margin: 0 auto;
	font-family: Times New Roman;
	text-align: center;
}

#header{
	margin: 0 auto;
	width: 760px;
	margin-top: 8%;
	border: 0px;
	position: center;
	text-align: left;
}

#container {
	width: 760px;
	margin: 0 auto;
	text-align: left;
	border: 0px;
	position: absolute center;
}

#navigation {
	background-color:#CC9966;
	margin: 0 auto;
	width: 760px;
	text-align: center;
	font-family: Times New Roman;
	font-weight: bold;
	color: #FFF;
	border: 0px;
	position: center;
}

a:link {
	text-decoration: none;
	color: #FFF;
}
a:active {
	text-decoration: none;
	color: #FFF;
}

a:hover {
	text-decoration: none;
	color: #333;
}

#content {
	width: 760px;
	position: center;
	font-family: Times New Roman;
	text-align: left;
	margin: 0 auto;
	padding: 0px;
}

#paragraph {
	position: center;
	font-family: Times New Roman;
	text-align: center;
}

#image {
	text-align: center;
	margin: 0 auto;
}

#counter  {
	position: left;
	padding: 2px;
	width: 100px;
	height: 42px;
	border: 0px;
}

#footer {
	width: 760px;
	position: center;
	text-align: center;
	font-family: Times New Roman;
	border-top: 1px solid #CC9966;
	margin: 0 auto;
}
E pensare che l'ho pure controllato con firebug, e con pagespeed di google... e i risultati sembrano buoni.

Beh speriamo di risolverlo questo problema ;)

Grazie mille di nuovo, saluti.
Avatar utente
freemind
Supervisor sezione Programmazione
Supervisor sezione Programmazione
Messaggi: 4643
Iscritto il: 04 apr 2007 19:28

Messaggio da freemind »

Guarda, senza provarlo non riesco a trovar nulla di strano.
Appena recupero una macchina win provo a far una paginetta e attaccarci il tuo css

ciao
Avatar utente
freemind
Supervisor sezione Programmazione
Supervisor sezione Programmazione
Messaggi: 4643
Iscritto il: 04 apr 2007 19:28

Messaggio da freemind »

Ciao,
hai voglia di postare il sorgente di una delle pagine alla quale applichi il css e che poi si imballa con ie6?
Anche senza contenuto, l'importante per ora sono i div delle varie regioni in modo da capire come fai a boxare le varie parti.
Ad esempio:

Codice: Seleziona tutto

<html>
	<head>
		<title></title>
	</head>
	<body>
		<div id="contenitore">
			<div id="testa"></div>
			<div id="wrapper">
				<div id="menu"></div>
				<div id="contenuto"></div>
			</div>
		</div>
	</body>
</html>
ovviamente usando i tuoi id nel posto giusto?
In pratica il template della pagina.

bau
IZ5IOW
Mortale devoto
Mortale devoto
Messaggi: 5
Iscritto il: 15 ago 2009 09:43

Messaggio da IZ5IOW »

Ecco lo "scheletro" del codice:

Codice: Seleziona tutto

<html>
<head>
	<title> Home </title>	
	<style type="text/css">
	@import "percorso del file .css";
	</style>	
</head>
<body>
	<div id="container">
	<div id="header">
	</div>
	
	<div id="navigation">
	</div>
	
	<div id="footer">
	</div>
</div>
</body>
</html>
Con l'occasione posto un paio di links in cui vengono proposti degli script in grado di "fissare" gli elementi...li ho provati e sembrano funzionare in parte, cioè alcuni elementi vengono messi al suo posto mentre altri rimangono sparsi nalla pagina (aperta con IE).

Eccoli:

http://code.google.com/p/ie7-js/
http://dean.edwards.name

Il secondo link è il sito web dell'autore...gli script proposti sono per IE7 e IE8 ma hanno gli stessi identici effetti. Li ho provati sia con IE6 che con IE7 ma non allineano tutti gli elementi a dovere, come già detto in precedenza.

Grazie a tutti...saluti e buona giornata.
Avatar utente
freemind
Supervisor sezione Programmazione
Supervisor sezione Programmazione
Messaggi: 4643
Iscritto il: 04 apr 2007 19:28

Messaggio da freemind »

Aspetta, non ho provato la roba però mi insospettisce il "center" che usi nel posizionamento di alcuni div.

Il valore "center" non è previsto per la proprietà "position"

Visual formatting model
9.3.1 Choosing a positioning scheme: 'position' property

The 'position' and 'float' properties determine which of the CSS 2.1 positioning algorithms is used to calculate the position of a box.

'position'
Value: static | relative | absolute | fixed | inherit
Initial: static
Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified

The values of this property have the following meanings:

static
The box is a normal box, laid out according to the normal flow. The 'top', 'right', 'bottom', and 'left' properties do not apply.
relative
The box's position is calculated according to the normal flow (this is called the position in normal flow). Then the box is offset relative to its normal position. When a box B is relatively positioned, the position of the following box is calculated as though B were not offset. The effect of 'position:relative' on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, and table-caption elements is undefined.
absolute
The box's position (and possibly size) is specified with the 'top', 'right', 'bottom', and 'left' properties. These properties specify offsets with respect to the box's containing block. Absolutely positioned boxes are taken out of the normal flow. This means they have no impact on the layout of later siblings. Also, though absolutely positioned boxes have margins, they do not collapse with any other margins.
fixed
The box's position is calculated according to the 'absolute' model, but in addition, the box is fixed with respect to some reference. As with the 'absolute' model, the box's margins do not collapse with any other margins. In the case of handheld, projection, screen, tty, and tv media types, the box is fixed with respect to the viewport and does not move when scrolled. In the case of the print media type, the box is rendered on every page, and is fixed with respect to the page box, even if the page is seen through a viewport (in the case of a print-preview, for example). For other media types, the presentation is undefined. Authors may wish to specify 'fixed' in a media-dependent way. For instance, an author may want a box to remain at the top of the viewport on the screen, but not at the top of each printed page. The two specifications may be separated by using an @media rule, as in:
Preso da w3c.org

Quando avevo letto il css la prima volta mi era scappata questa cosa.
IZ5IOW
Mortale devoto
Mortale devoto
Messaggi: 5
Iscritto il: 15 ago 2009 09:43

Messaggio da IZ5IOW »

Strano !! :shock:

A leggere l'articolo hai perfettamente ragione. Ho provato a toglierlo e a sostituire i valori, purtroppo il risultato è stato pessimo. Tutti gli elementi si sono spostati. Comunque voglio fare prove più approfondite con il "position" prima di scrivere altre cose...

Grazie per ora...saluti

Torna a “Linguaggi per Internet”