Suche im Forum:
Suchen


Autor Nachricht
Beitrag16.10.2008 um 16:22 (UTC)    
Titel: Problem mit Menü Code

Liebe Community,
ich habe mir mal ein kleines Menü auf der Seite http://kevka95.bplaced.net/menu.html erstellt.
Allerdings wird der Name des Buttons von der Höhe her nicht ganz in der Mitte angezeigt. Was muss ich ändern damit er in der Mittel angezeigt wird ?

Der Quellcode der HTML-Datei:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="content-style-type" content="text/css">
<link rel="stylesheet" type="text/css" href="menustyle.css">
<title>Browsergame</title>


</head>
<body>

<div class="menu">
<ul>
<li><a href="">Link 1</a></li>

<li><a href="">Link 2</a></li>

<li><a href="">Link 3</a></li>

<li><a href="">Link 4</a></li>

<li><a href="">Link 5</a></li>
</ul>
</div>

</body>
</html>


Der Quellcode der CSS-Datei:
Code:
<style type="text/css" media="screen">
<!--
body
{
font-family: Verdana, sans-serif;
font-size: 14px;
overflow: auto;
padding: 10px;
margin: 0px;
}

ul, li
{
list-style-type: none;
padding: 0px;
margin: 0px;
}

.menu
{
position: absolute;
z-index: 3;
top: 10px;
left: 10px;
}

.menu li
{
width: 140px;
float: left;
}

.menu a
{
background-image:url("img/button.png");
text-decoration: none;
text-align: center;
font-weight: bold;
cursor: default;
margin: 0px 2px;
display: block;
height: 50px;
color: #000;
}

.menu a:hover
{
background-image:url("img/buttonh.png");
}


//-->
</style>


mfg
stabaum-games
Beitrag17.10.2008 um 12:02 (UTC)    
Titel: Lösung gefunden!

Also.. du musst eigentlich nur änderungen am CSS-Code vornehmen!!

1. Damit die Bilder überhaupt angezeigt werden, musst du sie dir auf
http://kevka95.bplaced.net/img/button.png bzw. http://kevka95.bplaced.net/img/buttonh.png abspeichern und hochladen, bzw.
von dort übernehmen! Diese Bild URL-s musst du dann unten den CSS code einbinden (rot markiert)


-------------------------------------------------------------------------------
<style type="text/css" media="screen">
<!--
body
{
font-family: Verdana, sans-serif;
font-size: 14px;
overflow: auto;
padding: 10px;
margin: 0px;
}

ul, li
{
list-style-type: none;
padding: 0px;
margin: 0px;
}

.menu
{
position: absolute;
z-index: 3;
top: 10px;
left: 10px;
}

.menu li
{
width: 140px;
float: left;
}

.menu a
{
background-image:url("http://kevka95.bplaced.net/img/button.png");
text-decoration: none;
text-align: center;
font-weight: bold;
cursor: default;
margin: 0px 2px;
display: block;
height: 50px;
color: #000;
}

.menu a:hover
{
background-image:url("http://kevka95.bplaced.net/img/buttonh.png");}


//-->
</style>

---------------------------------------------------------------------------------------------

2. Zum Hauptproblem!
Du musst eigentlich nur 2 Padding (Innenabstände) bei ".menu a" und dem dazugehörigen hover ".menu a:hover einbinden! das ist ganz leicht! gefragt sind dabei nur "padding-top" also Innenabstand von oben^^-->rot markiert
Damit die höhe gleich bleibt musst du sie um 15 px kleiner machen (grün makiert


<style type="text/css" media="screen">
<!--
body
{
font-family: Verdana, sans-serif;
font-size: 14px;
overflow: auto;
padding: 10px;
margin: 0px;
}

ul, li
{
list-style-type: none;
padding: 0px;
margin: 0px;
}

.menu
{
position: absolute;
z-index: 3;
top: 10px;
left: 10px;
}

.menu li
{
width: 140px;
float: left;
}

.menu a
{
background-image:url("http://kevka95.bplaced.net/img/button.png");
text-decoration: none;
text-align: center;
font-weight: bold;
cursor: default;
margin: 0px 2px;
padding-top: 15px;
display: block;
height: 35px;
color: #000;
}

.menu a:hover
{
background-image:url("http://kevka95.bplaced.net/img/buttonh.png");
padding-top: 15px;}


//-->
</style>
----------------------------------------------------------------------------------------------




ich hoffe ich konnte dir damit helfen!^^

VG Poddi


Zuletzt bearbeitet von poddi am 19.10.2008, 21:19, insgesamt 5-mal bearbeitet
Beitrag17.10.2008 um 13:08 (UTC)    
Titel:

Danke !!!
Genau den Code habe ich gebraucht !
Beiträge der letzten Zeit anzeigen:   


Powered by phpBB © 2001, 2005 phpBB Group
Deutsche Übersetzung von phpBB.de