nav

CSS: 让编写更高效的选择器

允我心安 提交于 2019-12-13 15:26:22
高效的CSS已经不是一个新的话题了,也不是我一个非得重拾的话题,但它却是我在工作之时,所感兴趣的,关注已久的话题。 有很多人都忘记了,或在简单的说没有意识到,CSS在我们手中,既能很高效,也可以变得很低能。这很容易被忘记,尤其是当你意识到你会的太少,CSS代码效率很低的时候。 下面的规则只真正被应用到那些速度要求很高,有成百上千的DOM元素被绘制在页面上的大型网站。但是,实践出真理,多知道一点总是好的。 CSS 选择器 对我们大多数人来说,CSS选择器并不陌生。最基本的选择器是元素选择器(比如div),ID选择器(比如#header)还有类选择器(比如.tweet)。 一些的不常见的选择器包括伪类选择器(:hover),很多复杂的CSS3和正则选择器,比如:first-child,class ^= “grid-”。 CSS选择器具有高效的继承性, CSS选择器效率从高到低的排序如下: ID选择器 比如#header 类选择器 比如.promo 元素选择器 比如 div 兄弟选择器 比如 h2 + p 子选择器 比如 ul > li 后代选择器 比如 ul a 通用选择器 比如 * 属性选择器 比如 type = “text” 伪类/伪元素选择器 比如 a:hover 我们不得不提的是,纵使ID选择器很快、高效,但是它也仅仅如此。从CSS

Two colored navigation bar

北战南征 提交于 2019-12-13 11:15:22
问题 I want to do a navigation bar like in this picture. The bar has two colored div. But the content of this divs must be in a wrapper, like the other contents of the page, but i don't know how to do it. The navigation bar must be fixed, but i think it's not important now. Edit: http://jsfiddle.net/2NA8V/ My working code: <nav> <div id="headerLogo"> <h1> <a href="index.php"> <img src="..." class="headerImage"> </a> </h1> <ul> <li class="mainMenuPoint">Szurkolói Klub</li> <li class="mainMenuPoint"

How to edit this nav to make it a click nav instead of a hover nav?

拜拜、爱过 提交于 2019-12-13 09:19:54
问题 This is the following snippet I want to edit. http://www.cssscript.com/simple-accordion-menu-with-css3-transitions/ heres the demo http://www.cssscript.com/demo/simple-accordion-menu-with-css3-transitions/ I want to click to dropdown and it stays dropped down until I click on another menu or the same one again. Any idea on how I would be able to do this? 回答1: Got a solution. Here you go: fiddle .menu li a:focus + ul li a{ styles here} I've also added a jQuery equivalent of a JavaScript return

jQuery class change based on scroll ignoring last section

蓝咒 提交于 2019-12-13 05:18:27
问题 I'm using jQuery to guide my pages scrolling and change the color of a nav item to correspond to the section you're in. Everything's working well, but the script is ignoring the last section on the page (Contact). This is largely based on another question here on Stack, but I've modified the code to fit my needs and then ran into the issue. Test site: http://dev4.dhut.ch/ HTML: <nav> <ul> <li class="active"><a href="#music" title="Music">MUSIC</a></li> <li><a href="#photos" title="Photos"

Active state on nav after page refresh

空扰寡人 提交于 2019-12-13 04:26:57
问题 This is the code I am using at the moment to add an active state to an item after your clicked on one of the navigation and the page has been redirected. I was wondering if there was another way to do it because it works only on my local machine but not on a server. $(document).ready(function () { current_page = document.location.href if (current_page.match(/home/)) { $("ul#ulMenuNav li:eq(0) a").addClass('navActive'); } else if (current_page.match(/about/)) { $("ul#ulMenuNav li:eq(1) a")

Footer's nav submenu won't stay open after I mouse out unless I mouse over quickly and hover far left/right of my ul open submenu

爷,独闯天下 提交于 2019-12-13 03:23:31
问题 I am building a website that will be responsive and I need a fixed footer nav centered in the middle of the screen that when hovered over activates a drop-up menu. I am using only percentages for everything (important for lining things up width-wise with my header in the long run) which is making everything a little confusing for me. Whenever I hover over INFO (see my JSFiddle) and attempt to move my mouse upwards toward the submenu, the submenu drops as soon as I leave INFO . When I remove

CSS appears different on Windows than Mac

久未见 提交于 2019-12-13 01:57:45
问题 When I view the site in Windows then most of the site, like the top text, right contact details, nav text and welcome text appear lower than they do on the mac. Mac browsers show the CSS as it should be. Please help me out... Mac screenshot Windows screenshot HTML <body> <div id="wholepage"> <header> <div id="nav_top"> <nav> <h1 class="slogan">Steel & Fabrication Specialists</h1> </nav> </div> <a href="index.html"><img class="kks_logo" src="KKSLogo.png" border="0" alt="KKS Services Ltd logo">

Custom Nav in Wordpress not Loading Pages

我只是一个虾纸丫 提交于 2019-12-13 01:39:36
问题 I've created a custom nav in html/css and have applied it to my header.php file in wordpress (with all the page links linking to my html pages). How would I use this nav style as my main nav? ie. whenever I create a page, the page link goes onto the nav? I've tried deleting all the html links but it doesn't seem to work. Here's a link to the site at the moment: http://ixd487.firebird.sheridanc.on.ca/wordpress/ Below is what I pasted into the nav section in my header.php <!-- nav --> <nav

adding search bar to the nav menu in wordpress

落爺英雄遲暮 提交于 2019-12-12 18:35:24
问题 http://www.lundarienpress.com/ ( this is a wordpress site) This is my site, I am trying to add a search bar to the nav menu and have it to the right. Any ideas ? I have not found a way to do it. I am hoping some one from the forum can help me. 回答1: Function.php code: function add_last_nav_item($items, $args) { if ($args->menu == 'header_menu') { $homelink = get_search_form(); $items = $items; $items .= '<li>'.$homelink.'</li>'; return $items; } return $items; } add_filter( 'wp_nav_menu_items'

How to disable bootstrap nav-justified collapse for smaller devices

て烟熏妆下的殇ゞ 提交于 2019-12-12 12:31:06
问题 I am using bootstrap to justify a bunch of tabs to evenly fit the width of the parent element. This is important to me. However Bootstrap automatically collapses these for smaller devices, giving them 100% width, which I don't want. How can I disable this function? Simple Code: <ul class="nav nav-tabs nav-justified> <li></li> <li></li> <li></li> </ul> 回答1: You can add a container with class col-xs-12 thus it will be stacked on very small displays. After all if you want it to be non-stacked in