Antworten auf deine Fragen:
Neues Thema erstellen

z-index trotz positionsangabe bei navi funktioniert nicht

Konzertjunkie

Noch nicht viel geschrieben

Hallo liebes PSD Forum.
Ich bastele mir grade meine Portfolio Webpage. Dort möchte ich meine Navigation als Backgrund Image angeben und dann per list Div's die Links zu den verschiedenen Seiten. So weit so gut. Bei mir funktioniert dort dann aber nicht die z-index Befehl um die Navi unter ein Div zu packen. :( Kennt jemand die Lösung für dieses Peoblem!?
Code:
<!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">

<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<meta name="robots" content="index" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="DC.title" content="Wigand Alpers" />
<meta name="DC.creator" content="..." />
<meta name="DC.subject" content="Radiosprecherseite" />
<meta name="DC.description" content="Webseite des Sprechers Wigand Alpers" />
<meta name="DC.publisher" content=".." />
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="formate.css" />

<title>Milandesign</title>
</head>

<body>
<div id="hintergrund">
<div id="oben">
<div id="bild"><img src="logos/logo.png" title="Logo" width="400px" height="400px" alt="Logo" /></div><!-- logo //-->
<div id="schriftzug">
<div id="navi">
<ul id="navi">

                       <li id="home"><a href="index.php">Home</a></li>

                       <li id="button2"><a href="#">Button 2</a></li>

                       <li id="button3"><a href="#">Button 3</a></li>

                       <li id="button4"><a href="#">Button 4</a></li>

                </ul>

</div><!-- navi //-->
</div><!-- schriftzug //-->
</div><!-- oben //-->
<div id="inhalt">
blindtext

</div><!-- inhalt //-->







</div><!-- hintergrund //-->
</body>
</html>
Css Datei:
Code:
body { background-color: #7a7a7a;background-image: url(bilder/parkett.png); color: #000000; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;
font-size: 12px;}
IMG { border: 0 none; }

h1 { font-size: 20px; padding: 0;  font-weight: bold; line-height: 20px; color: #000000;}

h2 { font-size: 18px; padding: 10px 0 0 0; text-align: left; font-weight: bold; line-height: 18px; color: #000000;}

h3 { font-size: 18px; padding: 10px 0 0 0; text-align: right; font-weight: bold; line-height: 18px; color: #000000;}

        .kursiv { font-size: 13px; padding: 3px 0 0 0; text-align: left; font-weight: normal;
                  font-style: italic; line-height: 15pt; width: 380px; color: #000000;}

         .fett { font-size: 13px; padding: 3px 0 0 0; text-align: center; font-weight: bold;
                  font-style: normal; line-height: 15pt; width: 380px; color: #000000;}

li { list-style-type: disc; }

table {
width: 100%;
empty-cells: hide;
border: 0px;

}


#hintergrund {
  margin: 0 auto;
  position: relative;
  margin-top: 0px;
  width: 1000px;
  height: 750px;
  color: #000000;
  padding: 0;
  }

#oben {
  width: 1000px;
  height: 250px;
  margin-top: 0px;
  margin-bottom: 0px;
  color: #FFFFFF;
  float: right;
  }

#bild {
  width: 194px;
  height: 143px;
  position: relative;
  float: left;
  margin: 0 auto;
  margin-top: 10px;
  color:#cc6633;
  z-index: 4;

}

#schriftzug {
  margin-top: 0px;
  margin: 0 auto;
  background-image:url(logos/mappe.png);
  width: 586px;
  position: relative;
  height: 295px;
  float: right;
  z-index: 4;
  }


#navi{
  margin-top: 70px;
  margin-left: 5px;
  position: relative;
  background-image: url(logos/menue.png);
  list-style: none;
  width: 360px;
  height: 275px;
  z-index: 2;
}

#navi li a{
  position: relative;
  text-indent: -9999px;
  display: block;
  text-decoration: none;
  width: 53px;
  height: 68px;
  z-index: 2;
}

#home a{
top: 70px;
left: 20px;
border:4px solid red;
z-index: 2;
}

#button2 a{
top: 132px;
left: 145px;
border:4px solid red;
z-index: 2;
}

#button3 a{
top:35px;
left:220px;
border:4px solid blue;
z-index: 2;
}

#button4 a{
top:90px;
left:250px;
border:4px solid yellow;
z-index: 2;
}

#inhalt {
 float: right;
  background-image: url(logos/inhalt.png);
  background-repeat: no-repeat;
  overflow: auto;
  position: relative;
  width: 980px;
  height: 760px;
  margin: 0 auto;
  margin-top: 0px;
  left: 70px;
  padding: 10px 10px 10px 10px;
  font-size: 10pt;
  text-align: left;
  line-height: 15pt;
  z-index: 2;
  }

  #inhalt ul { list-style-type: disc;}
  #inhalt table { border-collapse: collapse; }
  #inhalt a:link { color: #cc6633; text-decoration: none; }
  #inhalt a:visited { color: #cc6633; text-decoration: none; }
  #inhalt a:hover { color: #939393; text-decoration: underline; }
  #inhalt a:active { color: #838383; text-decoration: none; }


.bildlinks { float: left; padding: 1px; margin: 10px 10px 10px 0; padding: 2px; border: groove #000000 1px;}
.bildrechts { float: right; padding: 1px; margin: 10px 0 10px 10px; padding: 2px; border: groove #000000 1px}
und anschauen:
 
Zuletzt bearbeitet:

Ladyan

Nicht ganz neu hier

AW: z-index trotz positionsangabe bei navi funktioniert nicht

Ehrlich gesagt verstehe ich dein Problem nicht ganz?

Was genau soll wie anders angezeigt werden, als das gerade der Fall ist?
 

sokie

Mod | Web

AW: z-index trotz positionsangabe bei navi funktioniert nicht

ich würde an deiner stelle die ul als container mit dem position relative versehen, und die li darin positionieren(absolute). die li brauchen eine höhe und breite(und daraus folgend das display: block). die a bekommen auch display:block und height: 100%;
z-index braucht das nicht.



die ul muss aber auch nicht zwingend das Hintergrundbild enthalten.
 
Zuletzt bearbeitet:

Doitsu

Aktives Mitglied

AW: z-index trotz positionsangabe bei navi funktioniert nicht

.. die Navi ist im 'schriftzug'-Div, ist klar, dass sie dann drueber gestellt wird.
Warum schneidest du es nicht gleich so, dass die Mappe gleich ueber der Navi ist, also in einem Bild.

@ vorposter:
Der Zettel der Navi soll unter der roten Mappe oben Rechts angezeigt werden..
 
Zuletzt bearbeitet:

Konzertjunkie

Noch nicht viel geschrieben

AW: z-index trotz positionsangabe bei navi funktioniert nicht

Danke für die Vorschlage, habe dies jetzt auch so umgesetzt. Trotzdem gibt es noch Fehler, die ich mir nicht erklären kann.
1. Die weißen Punkte von der Aufzählung gehen mit list-style-type: none; nicht weg. Diese sind aber auch nur im Firefox und im IE zu sehen.
2. Im Browser Opera sind die Links nicht auf der gewünschten Stelle aber im Firefox und im IE schon, woher kommt dies?

Im Browser anschauen:
m.milandesign.de

Zum Überprüfen und anschauen nochmal der aktuelle Code:
Code:
body { background-color: #7a7a7a;background-image: url(bilder/parkett.png); color: #000000; font-family: Arial, Helvetica, sans-serif; margin: 0px; padding: 0px;
font-size: 12px;}
IMG { border: 0 none; }

h1 { font-size: 20px; padding: 0; text-align: left; font-weight: bold; line-height: 20px; color: #000000;}

h2 { font-size: 18px; padding: 10px 0 0 0; text-align: left; font-weight: bold; line-height: 18px; color: #000000;}

h3 { font-size: 18px; padding: 10px 0 0 0; text-align: right; font-weight: bold; line-height: 18px; color: #000000;}

        .kursiv { font-size: 13px; padding: 3px 0 0 0; text-align: left; font-weight: normal;
                  font-style: italic; line-height: 15pt; width: 380px; color: #000000;}

         .fett { font-size: 13px; padding: 3px 0 0 0; text-align: center; font-weight: bold;
                  font-style: normal; line-height: 15pt; width: 380px; color: #000000;}

li { list-style-type: disc; }

table {
width: 100%;
empty-cells: hide;
border: 0px;

}


#hintergrund {
  margin: 0 auto;
  position: relative;
  margin-top: 0px;
  width: 1000px;
  height: 750px;
  color: #000000;
  padding: 0;
  }

#oben {
  width: 1000px;
  height: 250px;
  margin-top: 0px;
  margin-bottom: 0px;
  color: #FFFFFF;
  float: right;
  }

#bild {
  width: 400px;
  height: 400px;
  background-image:url(logos/logo.png);
  position: relative;
  float: left;
  margin: 0 auto;
  margin-top: 10px;
  color:#cc6633;
  z-index: 4;

}

#navi {
  margin-top: 0px;
  margin: 0 auto;
  background-image:url(logos/menue.png);
  background-repeat: no-repeat;
  width: 580px;
  position: relative;
  height: 295px;
  float: right;
  z-index: 4;
  background-position:right top;
  }

  #navi ul {
  margin-top: 0px;
  margin: 0 auto;
  background-image:url(logos/menue.png);
  background-repeat: no-repeat;
  list-style-type: none;
  width: 580px;
  position: relative;
  height: 295px;
  float: right;
  z-index: 4;
}

#navi li a{
  position: relative;
  text-indent: -9999px;
  display: block;
  text-decoration: none;
  list-style-type: none;
  float: left;
  z-index: 2;
}

#home a{
top: 60px;
left: 10px;
width: 55px;
height: 35px;
border: 1px solid #0000ff;
list-style-type: none;
z-index: 2;
#home a:hover { color: #939393; text-decoration: underline; }

}

#referenzen a{
top: 75px;
left: 20px;
width: 80px;
height: 50px;
border: 1px solid #0000ff;
list-style-type: none;
z-index: 2;
#referenzen a:hover { color: #939393; text-decoration: underline; }
}

#ueber_mich a{
top: 105px;
left: 25px;
width: 75px;
height: 50px;
border: 1px solid #0000ff;
list-style-type: none;
z-index: 2;
#ueber_mich a:hover { color: #939393; text-decoration: underline; }
}

#kontakt a{
top: 135px;
left: 30px;
width: 65px;
height: 40px;
border: 1px solid #0000ff;
list-style-type: none;
z-index: 2;
#kontakt a:hover { color: #939393; text-decoration: underline; }
}

#impressum a{
top:155px;
left: 35px;
width: 90px;
height: 50px;
border: 1px solid #0000ff;
list-style-type: none;
z-index: 2;
#impressum a:hover { color: #939393; text-decoration: underline; }
}

#inhalt {
 float: right;
  background-image: url(logos/inhalt.png);
  background-repeat: no-repeat;
  overflow: auto;
  position: relative;
  width: 980px;
  height: 760px;
  margin: 0 auto;
  margin-top: 0px;
  left: 70px;
  padding: 10px 10px 10px 10px;
  font-size: 10pt;
  text-align: left;
  line-height: 15pt;
  z-index: 2;
  }

  #inhalt ul { list-style-type: disc;}
  #inhalt table { border-collapse: collapse; }
  #inhalt a:link { color: #cc6633; text-decoration: none; }
  #inhalt a:visited { color: #cc6633; text-decoration: none; }
  #inhalt a:hover { color: #939393; text-decoration: underline; }
  #inhalt a:active { color: #838383; text-decoration: none; }


.bildlinks { float: left; padding: 1px; margin: 10px 10px 10px 0; padding: 2px; border: groove #000000 1px;}
.bildrechts { float: right; padding: 1px; margin: 10px 0 10px 10px; padding: 2px; border: groove #000000 1px}

Html Datei:
Code:
<!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">

<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<meta name="robots" content="index" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="DC.title" content=".." />
<meta name="DC.creator" content="Milan Design" />
<meta name="DC.subject" content="Radiosprecherseite" />
<meta name="DC.description" content=".." />
<meta name="DC.publisher" content=".." />
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="formate.css" />

<title>Milandesign</title>
</head>

<body>
<div id="hintergrund">
<div id="oben">
<div id="bild"></div><!-- logo //-->
<div id="navi">
<ul id="navi">

                       <li id="home"><a href="index.php">Home</a></li>

                       <li id="referenzen"><a href="#">Referenzen</a></li>

                       <li id="ueber_mich"><a href="#">Button 3</a></li>

                       <li id="kontakt"><a href="#">Button 4</a></li>
               
                       <li id="impressum"><a href="#">Button 5</a></li>
                </ul>

</div><!-- navi //-->
</div><!-- oben //-->
<div id="inhalt">
<h1>blindtext</h1>

</div><!-- inhalt //-->







</div><!-- hintergrund //-->
</body>
</html>
 
Zuletzt bearbeitet:

Konzertjunkie

Noch nicht viel geschrieben

AW: z-index trotz positionsangabe bei navi funktioniert nicht

Danke! Das war Fehler nr. 2
Weiß jemand noch warum bei mir die Punkte angezeigt werden?
 

sokie

Mod | Web

AW: z-index trotz positionsangabe bei navi funktioniert nicht

Danke! Das war Fehler nr. 2
Weiß jemand noch warum bei mir die Punkte angezeigt werden?
Code:
li { list-style-type: disc; }
darum.

wenn du explizit für li elemente das list-style setzt, dann musst des es auch für li selektoren ändern:
Code:
#navi li[U] a[/U]{
  position: relative;
  text-indent: -9999px;
  display: block;
  text-decoration: none;
  [U]list-style-type: none;[/U]
  float: left;
  z-index: 2;
}
a elemente haben keinen list-style
Code:
#navi li{
  list-style: none;
}
würde den list-style entfernen.
wenn du das für die li elemente machst funktioniert es auf der einen Seite, auf der anderen, kannst du alle anderen wirkungslosen list-style-type regeln aus deinem CSS löschen.
 
Zuletzt bearbeitet:

Konzertjunkie

Noch nicht viel geschrieben

AW: z-index trotz positionsangabe bei navi funktioniert nicht

oh man, irgendwann wird man nur noch blind, wenn man codiert.
DANKE für das drüber schauen und finden!
 

hubspe

display:schwarzgelb;

AW: z-index trotz positionsangabe bei navi funktioniert nicht

So ein Unterstrich (ueber_mich ) in einer CSS kann auch schon mal Probleme bereiten. Dieser darf in ID- und Klassen-Namen nicht genutzt werden.

sorry, wenn ich dich korrigiere, aber das ist leider nicht ganz richtig. ;)

Selbstverständlich dürfen id- und Klassennamen Unterstriche, Bindestriche und Zahlen enthalten, nur die erste Stelle sollte idealerweise ein Buchstabe sein:
PHP:
id="spalte_rechts"
id="spalte-rechts"
id="spalte2rechts"
Diese Schreibweisen verursachen keine Probleme.
Nur von Umlauten sollte man besser Abstand nehmen.
 
AW: z-index trotz positionsangabe bei navi funktioniert nicht

sorry, wenn ich dich korrigiere, aber das ist leider nicht ganz richtig. ;)

Wenn man nicht alles bei der richtigen Quelle überprüft... :kopfpatsch:

Letztens gab's hier ein Thema, bei dem eine Ziffer am Anfang zu Problemen führte, und da wurde folgender Link geposted
, indem diese Aussage vorkam.
... Da geübte Programmierer gerne den Unterstrich verwenden um Variablennamen besser lesbar zu machen ( "eine_variable = 1;") und laut der Spezifikation von CSS in Klassen- oder ID-Namen kein Unterstrich vorhanden sein darf, kann so oft invalider CSS - Code entstehen. ...
Soll angeblich eine Studienarbeit sein, die von einem Professor betreut wird. Da dachte ich, ich hätte was dazu gelernt :hmpf:

Aber dank Dir habe ich jetzt beim W3C Syntax and basic data types geschaut und folgendes gefunden
In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a hyphen followed by a digit.
Werde mir einen Post-It an den Monitor kleben, auf dem steht:
"Immer kritisch bleiben! Und jede Quelle prüfen!"

Also vielen Dank für Deinen Hinweis, da ist gar kein "Sorry" nötig! :)
 

jackprince

xHTML & CSS Junkie

AW: z-index trotz positionsangabe bei navi funktioniert nicht

Das würde bei mir sämtlichst alle je angelegt css Datein invalid amchen wenn dem so wäre.

Meine CSS lebt von Unterstrichen ^_^
 
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Flatrate für Tutorials, Assets, Vorlagen

Zurzeit aktive Besucher

Keine Mitglieder online.

Statistik des Forums

Themen
118.565
Beiträge
1.538.067
Mitglieder
67.488
Neuestes Mitglied
Andrew56524
Oben