I wanna make a menu very small, so i have the initial letter for each name and i add "focus" but what i want its to appear the full word.
ex:
css:
.menu:focus {
}
php:
<nav>
<li class="menu"><a href="home.php>h</a></li><br>
<li class="menu"><a href="galery.php>g</a></li>
</nav>
and so you simply see the menu like:
h
g
and if you click in h for ex. you would see:
home
g
how can i do it?
and then if click again go to the link page.
is it possible?
edit
php:
<nav>
<li>
<span class="m">
H
</span>
<span class="f">
<a class="menu" href="home.php">
Home
</a>
</span>
</li>
</span>
css:
nav li .f {
display: none;
}
nav li:hover .f {
display: inline;
background-color: #202020;
}
until here ok, you pass by and it shows the full word with the link, but the objective its not just pass by, its to click on it i just change hover to focus and it stops working.
also the hover ".m" display none its not working. it should switch isnt it possible ?
css:
nav li:focus .f {
display: inline;
background-color: #202020;
}
nav li: hover .m {
display: none;
}
Thanks
i have created fiddle for u do you want something like this .
<nav>
<li class="menu">
<a href="home.php">
<span class="test">h</span><span class="test2">ome</span>
</a>
</li>
<li class="menu">
<a href="home.php">
<span class="test">g</span><span class="test2">alery</span>
</a>
</li>
nav li a .test2{display:none}
nav li a:focus .test2, nav li a:hover .test2{display:inline}
OR if you want javascript solution here is code for u
html
<nav class="nav">
<li class="menu">
<a href="javascript:;" data-url="home.php">
<span class="test">h</span><span class="test2">ome</span>
</a>
</li>
<li class="menu">
<a href="javascript:;" data-url="gallary.php">
<span class="test">g</span><span class="test2">alery</span>
</a>
</li>
CSS
nav li.menu a .test2{display:none;}
nav li.menu a .test2.open{display:inline;}
Jquery
$(".nav>li>a").click(function(e) {
var trig = false;
var links = $(this).data("url");
$(this).children(".test2").addClass("open");
if(trig == false){
$(this).click(function(e) {
window.location.href = links;
});
}
});
http://jsfiddle.net/ismailfarooq/p667L2y0/
Related
I have to remove certain items from a nav, which differ by their data-filter attribute. How can I refer to the specific list-items?
Such as, if I wanted to remove the item by data-filter ".category-xyz":
<li class="filter" data-filter=".category-xyz"><span>xyz</span></li>
I tried loads - all without any errors - nothing finds the specific list-item. I tried: (all each)
.filter-holder ul:nth-child(3){
display:none;
}
.filter .category-xyz{
display: none;
}
.filter-holder ul li[data-filter*=".category-xyz"]{
display: none;
}
li[data-filter=".category-xyz"]{
display:none;
}
.filter-holder ul li[data-filter|=category-xyz]{
display: none;
}
Somebody help?
You are missing a > in your HTML after xyz"
Other than that, your last 3 CSS rules should work.
Here is a working JS Fiddle.
li[data-filter=".category-xyz"]{
display:none;
}
<div class="filter-holder">
<ul>
<li class="filter" data-filter=".category-xyz"><span>xyz</span></li>
<li class="filter" data-filter=".category-abc"><span>abc</span></li>
<li class="filter" data-filter=".category-xyz"><span>xyz</span></li>
<li class="filter" data-filter=".category-abc"><span>abc</span></li>
<li class="filter" data-filter=".category-xyz"><span>xyz</span></li>
<li class="filter" data-filter=".category-abc"><span>abc</span></li>
</ul>
</div>
Hope this helps.
Your li opening tag is incomplete without >
Use prefix selector.
element [attribute = "value"]{
/*code*/
}
li[data-filter=".category-xyz"] {
background: blue;
}
li {
background: red;
}
<li class="filter" data-filter=".category-xyz">
<span>
xyz
</span>
</li>
<li class="filter" data-filter=".NOTcategory-xyz">
<span>
xyz
</span>
</li><li class="filter" data-filter=".NOTcategory-xyz">
<span>
xyz
</span>
</li>
I'm quite new to Bootstrap, I've set up a dropdown pill and played around with the colours.
What I'd like to do is change the colour of the dropdown title pill after it has been selected. It currently changes to a light grey:
Here is my code:
<div class="row hidden-xs">
<div class="col-md-12">
<ul class="nav nav-pills nav-justified nav-filter">
<li role="presentation">Valentine's Day</li>
<li role="presentation" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-expanded="false">
Recipient <span class="caret"></span>
</a>
</li>
<li role="presentation">Occasion</li>
<li role="presentation">Type</li>
<li role="presentation">New</li>
<li role="presentation">On Sale</li>
</ul>
</div>
</div>
What would the CSS be to overide this colour? - not the dropdown itself, just the title link.
Thanks
You would override the hover, active and focus state of .nav-pills like this..
.nav-pills>li>a:hover {
background-color: #FF6699;
}
.nav-pills .open>a, .nav-pills .open>a:active, .nav-pills .open>a:focus{
background-color: #FF6699;
}
Demo
This will change the background/text color of the active class (inc. focus):
.navbar-default .navbar-nav>.active>a,
.navbar-default .navbar-nav>.active>a:focus {
color: white;
background-color: blue;
}
Use following css:
.nav .open>a, .nav .open>a:hover, .nav .open>a:focus{
background-color: red;
}
.nav-tabs>li>a:hover {
background-color: red;
}
DEMO
.nav>li>a:hover,.nav>li>a:visited {
background-color: #222; /* add your desired color */
}
I using joomla 3.3.3 and boostrap 3.2.0
I have edited joomla menu module source to incorporate bootstrap classes to create drop down menus.
Browser renders drop down list as:
<ul class="nav navbar-nav">
::before
<li class="dropdown hovernav">
<a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Sample Sites</a>
<ul class="dropdown-menu nav-child unstyled small" role="menu" aria-labelledby="dLabel">
<li class="dropdown hovernav">
<a data-toggle="dropdown" href="/joomla_3_3_3/index.php/sample-sites-2/getting-started">Getting Started</a>
</li>
</ul>
</li>
::after
</ul>
The dropdown itself works fine (including with a third party hover js and css added). For some reason if I use href="#" for the parent of the drop down (so it doesn't link to a page) the li holding the parent drop down gets hidden as shown below:
<ul class="nav navbar-nav">
::before
<li class="dropdown hovernav" style="display: none;"> <===**** DISPLAY NONE GETS ADDED
<a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Sample Sites</a>
<ul class="dropdown-menu nav-child unstyled small" role="menu" aria-labelledby="dLabel">
<li class="dropdown hovernav">
<a data-toggle="dropdown" href="/joomla_3_3_3/index.php/sample-sites-2/getting-started">Getting Started</a>
</li>
</ul>
</li>
::after
</ul>
Bootstrap css for the nav li is:
.nav > li {
position: relative;
display: block;
}
.nav > li > a {
position: relative;
display: block;
padding: 10px 15px;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #eee;
}
.nav > li.disabled > a {
color: #777;
}
.nav > li.disabled > a:hover,
.nav > li.disabled > a:focus {
color: #777;
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
}
The display: block on the first nav > li rule seems to get disabled for some reason. Any help would be appreciated.
First up you shouldn't edit the menu module, you should instead create an alternative module layout for it which can then be selected from the (un-hacked) menu module.
What you are seeing is a conflict with Mootools, use of which is not supported in combination with Bootstrap. jQuery and Mootools (specifically mootools-more.js) are conflicting and as Bootstrap is dependant on jQuery you should not be loading Mootools as well.
p.s. There is a joomla.stackexchange.com now :)
I am using WordPress
I have put an extra container in the navigation menu. The navigation menu has the id #access, and the extra container has the id #language-selection . The #language-selection container uses <li> elements, but the hover and focus are overridden by the following:
#access li:hover > a,
#access ul ul :hover > a,
#access a:focus {
background: #efefef;
}
#access li:hover > a,
#access a:focus {
background: #f9f9f9; /* Show a solid color for older browsers */
background: -moz-linear-gradient(#f9f9f9, #e5e5e5);
background: -o-linear-gradient(#f9f9f9, #e5e5e5);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f9f9f9), to(#e5e5e5)); /* Older webkit syntax */
background: -webkit-linear-gradient(#f9f9f9, #e5e5e5);
color: #373737;
}
How can i overwrite these rules, so that nothing happens on hover and on focus on the #language-selection container, when it is inside the #access container?
Following is the HTML:
<nav id="access" role="navigation">
<h3 class="assistive-text">Main menu</h3>
<div class="skip-link">
<a class="assistive-text" href="#content" title="Skip to primary content">Skip to primary content</a>
</div>
<div class="skip-link">
<a class="assistive-text" href="#secondary" title="Skip to secondary content">Skip to secondary content</a>
</div>
<div class="menu">
<ul>
<li class="page_item page-item-24 current_page_item">
Home
</li>
<li class="page_item page-item-26">
Contact
</li>
</ul>
</div>
<div id="language-selection">
<ul class="qtrans_language_chooser" id="qtranslate-chooser">
<li class="lang-en active">
<a href="http://localhost/katarina/?lang=en" hreflang="en" title="English" class="qtrans_flag qtrans_flag_en">
<span style="display:none">English</span>
</a>
</li>
<li class="lang-DK">
<a href="http://localhost/katarina/?lang=DK" hreflang="DK" title="Dansk" class="qtrans_flag qtrans_flag_DK">
<span style="display:none">Dansk</span>
</a>
</li>
<li class="lang-fa">
<a href="http://localhost/katarina/?lang=fa" hreflang="fa" title="Farsi" class="qtrans_flag qtrans_flag_fa">
<span style="display:none">Farsi</span>
</a>
</li>
<li class="lang-ar">
<a href="http://localhost/katarina/?lang=ar" hreflang="ar" title="???????" class="qtrans_flag qtrans_flag_ar">
<span style="display:none">???????</span>
</a>
</li>
</ul>
<div class="qtrans_widget_end"></div>
</div>
</nav>
So basically i want hover and focus to remain the same on the "Home" and "Contact" links, but to be deactivated on every li element inside #language-selection
Since you've provided the HTML, it's a little easier to see what you mean. My advice would be to add .menu as a specifier in the style so it only works within that container and doesn't include #language-selection. So:
#access a:focus { ... }
Then becomes
#access .menu a:focus { ... }
Then it will only apply that style to the anchors found within the div.menu.
The key is to be as specific with your style as possible. Just be careful though, because the more you apply the higher the styles specificity goes up. Meaning:
<div id="foo">
<div id="bar">
<a class="baz">Hello, world!</a>
</div>
</div>
Then apply:
#foo #bar a { color: red; } /* higher specificity */
#bar a.baz { color: green; }
The link will actually be red and not green.
I want my navigation to look like this:
<icon> <icon> <icon>
Title Longer Title Title
Ideally, I want my code to look like:
<li>
<img src="images/icon.png" />
<a class="link_title">Title 1</a>
</li>
<li>
<img src="images/icon.png"/>
<a class="link_title">Title 2</a>
</li>
<li>
<img src="images/icon.png"/>
<a class="link_title">Title 3</a>
</li>
I already have it horizontal, but not sure how to get the link to appear right under the icon, without using a table, which I don't want to do. (Let me know if I must, though.)
li { text-align:center; }
li a.link_title { display:block; }
Also, you're closing your <a> tags with a </span>. This needs to be corrected:
<a class="link_title">Some Text</a>
try this:
li {
float:left;
text-align:center;
}
li a {
display:block;
}
li img {
margin:0 auto;
}