我想要一個導航欄來顯示圖像的一部分,但只顯示圖像,如果你當前在頁面上(比如說你點擊home,它會發現一部分圖片)。換句話說,我想要一個隱藏在欄中的圖像,只有當按鈕被點擊時纔會顯示圖像。 (每個按鈕都有自己的一張圖片。)圖像顯示導航欄
使用CSS和HTML可以做到這一點嗎?
代碼CSS導航欄:
@nav_bar_background: #000000 center center repeat-x scroll;
@nav_bar_border: 0px solid @container_outer_border_color;
@nav_bar_border_radius: 0 0 0 0;
@nav_bar_button_color: #f2f3f5;
@nav_bar_button_font: normal normal 15px Tahoma, Geneva, sans-serif;
@nav_bar_button_decoration: none;
@nav_bar_button_shadow: none;
@nav_bar_button_background: #050505 fixed;
@nav_bar_button_hover_color: @nav_bar_button_color;
@nav_bar_button_hover_font: @nav_bar_button_font;
@nav_bar_button_hover_decoration: @nav_bar_button_decoration;
@nav_bar_button_hover_shadow: @nav_bar_button_shadow;
@nav_bar_button_hover_background: @nav_bar_button_background;
@nav_bar_button_current_color: #ffffff;
@nav_bar_button_current_font: @nav_bar_button_font;
@nav_bar_button_current_decoration: @nav_bar_button_decoration;
@nav_bar_button_current_shadow: @nav_bar_button_shadow;
@nav_bar_button_current_background: #790a79 center repeat-x scroll;
@nav_bar_bubble_text_color: #ffffff;
@nav_bar_bubble_font: .8em "Trebuchet MS", Verdana, Arial;
@nav_bar_bubble_background: #790a79;
@nav_bar_bubble_border_radius: 0;
#navigation-menu { padding: 0 0px; background: @nav_bar_background; border: @nav_bar_border; .rounded-corners(@nav_bar_border_radius); }
#navigation-menu a { position: relative; }
#navigation-menu > ul, #navigation-menu > ul li { float: left; }
#navigation-menu > ul li a { display: inline-block; padding: 0 .75em; color: @nav_bar_button_color; font: @nav_bar_button_font; text-decoration: @nav_bar_button_decoration; text-shadow: @nav_bar_button_shadow; background: @nav_bar_button_background; line-height: 80px !important; width: auto }
#navigation-menu > ul li:hover a { color: @nav_bar_button_hover_color !important; font: @nav_bar_button_hover_font; text-decoration: @nav_bar_button_hover_decoration !important; text-shadow: @nav_bar_button_hover_shadow; background: @nav_bar_button_hover_background; line-height: 80px !important; width:auto }
#navigation-menu > ul li a.state-active { color: @nav_bar_button_current_color !important; font: @nav_bar_button_current_font; text-decoration: @nav_bar_button_current_decoration !important; text-shadow: @nav_bar_button_current_shadow; background: @nav_bar_button_current_background; line-height: 80px !important; width: auto}
#navigation-menu div.tip-holder { position: absolute; top: 5px; right: -5px; display: inline-block; }
#navigation-menu div.tip-holder div.tip-number { padding: 3px 7px 2px 7px; background-color: @nav_bar_bubble_background; .rounded-corners(@nav_bar_bubble_border_radius); font: @nav_bar_bubble_font; line-height: .8em; text-shadow: none; .box-shadow(2px, 2px, 2px, @shadow_color); height: .8em; color: @nav_bar_bubble_text_color; }
#navigation-menu div.tip-holder span.tip { border-top: 4px solid @nav_bar_bubble_background; border-left: 4px solid transparent; border-right: 4px solid transparent; position: absolute; left: 6px; }
當然,這是可能的,張貼您的代碼! – lmgonzalves
我想象一下,應用於整個導航元素的背景圖像可以實現該效果,然後將單個按鈕上的背景顏色移除。但是,如果你有一個初始版本的原型,它可能更容易幫助你。 – Katana314