F
Furtano
Gast
Hi,
ich habe ein Padding-Problem in CSS. Ich will dass das Rechteck mit einem Hover das gleiche Padding / Form hat wie wenn man drauf klickt.
Ich bekomme es nicht hin!
Hier ist es hochgeladen: www.furtano.de/error/
Hover:
Click: So soll das oberste Rechteck auch mit Hover aussehen.
menu.js
Vielen Dank,
Furtano
ich habe ein Padding-Problem in CSS. Ich will dass das Rechteck mit einem Hover das gleiche Padding / Form hat wie wenn man drauf klickt.
Ich bekomme es nicht hin!
Hier ist es hochgeladen: www.furtano.de/error/
Hover:

Click: So soll das oberste Rechteck auch mit Hover aussehen.

menu.js
PHP:
$(document).ready(function(){
$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
$("ul.topnav li span").click(function() { //When trigger is clicked...
//Following events are applied to the subnav itself (moving subnav up and down)
$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
$(this).parent().hover(function() {
}, function(){
$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
});
//Following events are applied to the trigger (Hover events for the trigger)
}).hover(function() {
$(this).addClass("subhover"); //On hover over, add class "subhover"
}, function(){ //On Hover Out
$(this).removeClass("subhover"); //On hover out, remove class "subhover"
});
});
PHP:
#navi {
height: 72px;
width: 950px;
background-color: white;
border-color: #DCDCDC;
border-style: solid;
border-width: 1px;
float: left;
padding-left: 0px;
margin-top: -1px;
}
#navibar {
padding-top: 10px;
padding-left: 10px;
list-style: none;
}
#navibar li {
display: inline;
}
#navibar li a {
text-decoration: none;
color: #4D6968;
}
#navibar li a:hover{
display: inline;
background-color: #f5f5f5;
}
ul.topnav {
list-style: none;
padding: 0 20px;
margin: 0;
float: left;
width: 920px;
background: #222;
font-size: 15px;
background: url(topnav_bg.gif) repeat-x;
font-family: Verdana;
}
ul.topnav li {
float: left;
margin: 0;
padding: 0 15px 0 0;
position: relative; /*--Declare X and Y axis base for sub navigation--*/
}
ul.topnav li a{
padding: 10px 5px;
color: #fff;
display: block;
text-decoration: none;
float: left;
}
ul.topnav li a:hover{
background-color: black;
}
ul.topnav li span { /*--Drop down trigger styles--*/
margin-top: 13px;
width: 48px;
height: 25px;
float: left;
padding-left:35px;
background: url(../images/auto3.png) no-repeat center top;
}
ul.topnav li span.subhover {
background-color: #F5F5F5;
} /*--Hover effect for trigger--*/
ul.topnav li ul.subnav {
list-style: none;
position: absolute; /*--Important - Keeps subnav from affecting main navigation flow--*/
left: 0; top: 35px;
margin: 0; padding: 0;
display: none;
float: left;
width: 170px;
font-size: 16px;
}
ul.topnav li ul.subnav li{
border-top: 1px solid white; /*--Create bevel effect--*/
border-bottom: 1px solid white; /*--Create bevel effect--*/
clear: both;
width: 125px;
}
html ul.topnav li ul.subnav li a {
float: left;
width: 115px;
background-color: white;
padding-left: 20px;
background-color: #f5f5f5;
}
html ul.topnav li ul.subnav li a:hover { /*--Hover effect for subnav links--*/
background-color: #2763FF !important;
color: white !important;
}
PHP:
<div id="navi">
<ul class="topnav" id="navibar">
<li id="mainList">
<ul class="subnav">
<li><a href="#">Suchen</a></li>
<li><a href="#">Verkaufen</a></li>
<li><a href="#">Vorteile von Händler</a></li>
<li><a href="#">Sicherheit</a></li>
<li><a href="#">Kaufvertrag</a></li>
</ul>
</li>
</ul>
</div>
Vielen Dank,
Furtano
Zuletzt bearbeitet von einem Moderator: