I'm trying to set up a nav button system where you either hover or click on the SVG ( which is but it as a separate php) then there will be button drop dop, but more like transparent button.
text with a clear background (no box or border). how do I do this?
The Many Ways to Change an SVG Fill on Hover (and When to Use Them)
#CSS Filters
CSS filters allow us to apply a whole bunch of cool, Photoshop-esque effects right in the browser. Filters are applied to the element after the browser renders layout and initial paint, which means they fall back gracefully. They apply to the whole element, including children. Think of a filter as a lens laid over the top of the element it's applied to.
You can change the opacity with the opacity filter opacity(<number-percentage>); .
and you can put this in a hover css tag
.navbar:hover {
filter: opacity(<number-percentage>);
}
And here is how you make a dropdown navbar:
<div class="navbar">
Home
News
<div class="dropdown">
<button class="dropbtn">Dropdown
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
</div>
here is the css to the navbar:
/* Navbar container */
.navbar {
overflow: hidden;
background-color: #333;
font-family: Arial;
}
/* Links inside the navbar */
.navbar a {
float: left;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* The dropdown container */
.dropdown {
float: left;
overflow: hidden;
}
/* Dropdown button */
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit; /* Important for vertical align on mobile phones */
margin: 0; /* Important for vertical align on mobile phones */
}
/* Add a red background color to navbar links on hover */
.navbar a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
/* Dropdown content (hidden by default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
/* Add a grey background color to dropdown links on hover */
.dropdown-content a:hover {
background-color: #ddd;
}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
display: block;
}
Related
I have a listbox, I need it to on select neither change text color as active or inactive, focus or not focused. Its click add, click add. On this one the text stays white on select, and turns black when click out of the listbox. I need it to stay red and only background to change when its clicked, to show it was clicked, then just go back to black. (Ive been at this for a couple days before asking, might have errors in the code after rewriting it so many times.)
<select onclick="" class="sometext" name="sometext" size="5">
<?php
$sql = "select * FROM mom WHERE type='feedme'";
foreach ($dblsm->query($sql) as $row){
echo "<option value=$row[id]>$row[title]</option>";
/* Option values are added by looping through the array */
}
?>
</select>
css
/* turn it off completely */
select:active, select:hover, select:focus {
outline: none;
}
select option:hover {
background: linear-gradient(#a81b1b, #000000);
background-color: #000000 !important; /* for IE */
color: #a81b1b !important;
outline: none;
}
select option:checked, select option:active, select option:disabled {
background: linear-gradient(#000000, #000000);
background-color: #000000 !important; /* for IE */
color: #a81b1b !important;
}
.sometext::-webkit-scrollbar {
width: 8px;
}
/* Track */
.sometext::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-border-radius: 10px;
border-radius: 10px;
}
/* Handle */
.sometext::-webkit-scrollbar-thumb {
-webkit-border-radius: 10px;
border-radius: 10px;
background: #a81b1b;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}
.sometext {
color: #a81b1b;
background-color: black;
width: 225px;
border: 3px inset;
border-color: #a81b1b;
scrollbar-face-color: #367CD2;
scrollbar-shadow-color: #FFFFFF;
scrollbar-highlight-color: #a81b1b;
scrollbar-3dlight-color: #FFFFFF;
scrollbar-darkshadow-color: #FFFFFF;
scrollbar-track-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;
}
So, if I understand your question better now from your comments, I'm not sure how to accomplish this with the default options of a form's select box. What I did come up with for you is a way to get a similar outcome with plain ol' html/js/css and hopefully you can adapt this to your needs:
<html>
<head>
</head>
<body>
<div>
<ul class="redhue">
<li onClick="changeSelectionTo(this)">1</li>
<li onClick="changeSelectionTo(this)">2</li>
<li onClick="changeSelectionTo(this)">3</li>
</ul>
</div>
<script>
var currentlySelected;
function changeSelectionTo(item) {
if(currentlySelected){
currentlySelected.classList.remove("selected");
}
currentlySelected = item;
item.classList.add("selected");
console.log(item.innerText);
}
</script>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li:hover,
.selected {
background: linear-gradient(#a81b1b, #000000);
background-color: #000000; /* for IE */
color: #a81b1b;
}
.redhue {
color: #a81b1b;
background-color: black;
width: 225px;
border: 3px inset;
border-color: #a81b1b;
list-style: none;
}
</style>
</body>
</html>
I left the console.log statement to show how to retrieve the list item's value for whatever you would need it for... Hope this helps!
As you can see, I commented out the code for the dropdown menu, the menu works. But it isn't aligned with the rest of the navigation bar. Any help is appreciated.
<div id="top_nav">
<div id="top_nav_container">
<ul>
<li>Home</li>
<li>Redacted</li>
<li>How It Works</li>
<li>FAQs</li>
<li>Special Offers</li>
<li>Customer Service</li>
<!-- <span class="dropdown">
<span class="dropbtn">Special Offers</span>
<span class="dropdown-content">
Link 1
Link 2
Link 3
</span> -->
</ul>
</div>
Here's the CSS - the original is towards the bottom (after "cont.", the top was added later from an external source)
/* TOP NAV */
/* dd
/* Style The Dropdown Button */
.dropbtn {
background-color: #5d72b3;
color: white;
margin:auto;
padding: 0px;
text-align:center;
font-size: 14px;
border: none;
cursor: pointer;
text-decoration:none;
border-right:1px solid #FFF;
padding:9px 12px 0 12px;
}
/* The container <div> - needed to position the dropdown content */
.dropdown {
position: relative;
display: inline-block;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #f1f1f1}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
display: block;
}
/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
/*________________________cont. */
#top_nav_container {
position:relative;
width:1000px;
margin:auto;
height:33px;
}
#top_nav {
width:1000px;
height:33px;
background-color:#5d72b3;
border-bottom:1px solid #FFF;
border-top:1px solid #FFF;
margin:auto;
}
#top_nav ul {
width:849px;
margin:0;
padding:0;
list-style:none;
}
#top_nav ul li {float: left;}
#top_nav ul li a {
display:block;
width:auto;
height:24px;
text-align:center;
font-size:14px;
font-family:Arial, Helvetica, sans-serif;
color:#FFF;
text-decoration:none;
border-right:1px solid #FFF;
padding:9px 12px 0 12px;
}
#top_nav ul li a:hover {
background-color:#86a3ff;
}
#sub_nav_bar {
width:1000px;
height:40px;
margin:0 auto 6px auto;
text-align:center;
}
Redacted company info djdjsjshsjshhshshshshshshshhshshshshshshshshshhshshs
Sjshshsjs
Hshshshshshshsh jsjsjsjsjhshss
.dropbtn { display: block;
height: 24px; }
I have a problem when making a wordpress theme integrated with woocommerce like cannot show "add to cart" button when hovering a cursor in product box and only show when hovering a cursor to bottom in product box like GIF below:
woocommerce.css
.woocommerce ul.products li.product .button {
margin: 1em 0 3px 0.3em;
}
.woocommerce a.button {
/* font-size: 100%; */
/* margin: 0; */
/* line-height: 1; */
/* cursor: pointer; */
position: relative;
font-family: inherit;
text-decoration: none;
overflow: visible;
padding: 0.618em 1.75em;
font-weight: 700;
/* border-radius: 3px; */
/* left: auto; */
color: transparent;
background-color: transparent;
/* border: 0; */
/* white-space: nowrap; */
/* display: inline-block; */
/* background-image: none; */
/* box-shadow: none; */
/* -webkit-box-shadow: none; */
/* text-shadow: none; */
}
.woocommerce a.button:hover {
background-color: #f37020;
text-decoration: none;
color: #fff;
background-image: none;
}
.woocommerce ul.products li:hover {
border: 3px solid;
border-color: #f37020;
}
How I can fix it?
UPDATED (Dec 11,2015):
Its my URL link: http://dev.galerigadget.com/shop/
Obviously your "add to cart" button is only displaying when you hover the lower part of the box. That indicates only the bottom area is linked. Your "a" element might need to be "display:block" so it covers the entire block inside the brown rule. Hard to tell without seeing the actual site. Can you post URL?
AFTER EXAMINING YOUR CODE, HERE IS WHAT IS HAPPENING
The add-to-cart link is there, even when not hovered.
You do not see it b/c the CSS includes:
color: transparent;
background-color: transparent;
I would remove those parameters so the button is visible in gray and white. Looks nice and tells the user where to click to purchase the item.
You still have the hover effect that changes the button color to brown, but now the user clearly sees where to put their cursor.
If you want the button 'hidden' until the box is hovered, and then turn brown when hovering the box, add this to your CSS:
li:hover a.add_to_cart_button {
background-color: #f37020;
text-decoration: none;
color: #fff;
background-image: none;
}
Here is an example
$(document).ready(function () {
$(document).on('mouseenter', '.divbutton', function () {
$(this).find(":button").show();
}).on('mouseleave', '.divbutton', function () {
$(this).find(":button").hide();
});
});
.divbutton {
height: 140px;
background: #0000ff;
width:180px;
}
button{
padding: 4px;
text-align: center;
margin-top: 109px;
margin-left: 7px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="divbutton" ">
<button type="button" style="display: none;">ADD TO CART</button>
</div>
Or If you want to use only CSS
button {
display: none; /* Hide button */
}
.divbutton:hover button {
display: block; /* On :hover of div show button */
}
I am having some difficulty styling the Wordpress menu and to behave how I want it to.
So I am using the following to display my menu:
<nav>
<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
<br />
<form method="get" id="search_form" action="<?php bloginfo('home'); ?>"/>
<input type="text" class="text searchForm" name="s" value="Search" >
</form>
</nav>
Here is the style:
nav li {
background-color: #99D9F3;
margin-bottom: 2px;
padding: 0;
font-weight: 300;
}
nav a {
color: #000;
margin: 0;
padding: 5px; /* you can apply padding to the anchor tags instead */
text-decoration: none;
display:inline-block;
}
.sub-menu{background-color: #fff;}
.sub-menu li {
background-color: #fff;
margin: 5px;
padding: 0;
font-weight: 300;
border-left: 2px solid white;
}
.sub-menu li:hover{
border-left: 2px solid orange;
}
.sub-menu a{color:#aaa;}
.sub-menu a:hover{color:#000; font-weight: 500;}
This is all well and good apart from a few things, only the text is clickable where as I need the whole <li> to be a clickable area. Also, when adding sub items to the menu it stretches out the <li> tag from the menu item they sit under, I need a way to hide those too until the item is clicked on and it then shows the sub menu items.
Don't use padding for the list items. Also you need to set the property value of your anchor tags display to inline-block or block.
display:inline-block;
/* Or just */
display:block;
See the chnages below
nav li {
background-color: #99D9F3;
margin-bottom: 2px;
padding: 0;
font-weight: 300;
}
nav a {
color: #000;
margin: 0;
padding: 5px; /* you can apply padding to the anchor tags instead */
text-decoration: none;
display:inline-block;
}
http://users.tpg.com.au/j_birch/plugins/superfish/examples/
You can use superfish menu jquery.. It will help you
I have a menu bar like this
<header>
<nav>
Home
Our Story
Tools
Technology
Pricing
Contact
Careers
</nav>
</header>
The CSS is follows
header {
position: fixed;
width: 100%;
height: 65px;
opacity: 0.8;
background-color: #fcfcfc;
border-bottom: 5px solid #53bf6b;
z-index: 10;
}
header nav {
padding-top: 10px;
text-align: center;
}
header nav a {
text-decoration: none;
font-family: 'Roboto', sans-serif;
font-weight: 300;
font-size: 26px;
padding-right: 20px;
color: #f35626;
background-image: -webkit-linear-gradient(92deg, #f35626, #feab3a);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-animation: hue 60s infinite linear;
}
And when the user resizes I want to Nav A to be followed below (align vertically) How can I do this ?
#media only screen and (min-width: 150px) and (max-width: 550px) {
/* I must set the code to arrange the nav a items here */
}
What should I do to make the nav a items follow each other vertically when resized ?
Use display block like there:
http://jsfiddle.net/c0y518bn/
#media only screen and (min-width: 150px) and (max-width: 550px) {
nav a {display: block;}
}
Fixed border-bottom version: http://jsfiddle.net/c0y518bn/1/
header nav a {
display: block; /* you can also try position:relative; */
}