i have this navbar, when i hover on tag the result is :
when hover on
i try to make it like that , but i can't :
i need like this pic
.
menu-large-hover {
position: static !important;
border-left: 1px solid black;
border-right: 1px solid black;
border-bottom: none;
cursor: pointer;
text-decoration: underline;
}
add/edit below classes in your css
.menu-large-hover a#font-mega {
background: #fff;
z-index: 200000;
padding: 16px 27px
}
.navbar-nav > li {
margin: 0 9px 0 0;
height: 51px
}
Related
This question already has answers here:
how to make a background-color on a div tag
(2 answers)
background color inside my <div> element using CSS
(4 answers)
Closed 2 years ago.
I found a button code so I used it. After that I saw that the button was completely transparent I learned how to colorize its text but not the background.
Can you assist?
The Code is:
.my_content_container a {
border-bottom: 1px solid #777777;
border-left: 1px solid #000000;
border-right: 1px solid #333333;
border-top: 1px solid #000000;
color: #000000;
display: block;
height: 2.5em;
padding: 0 1em;
width: 5em;
text-decoration: none;
}
<div class="my_content_container">
Go to my link location
</div>
Use background property background-color to change the background color.
Example:
.my_content_container a {
border-bottom: 1px solid #777777;
border-left: 1px solid #000000;
border-right: 1px solid #333333;
border-top: 1px solid #000000;
color: #000000;
display: block;
height: 2.5em;
padding: 0 1em;
width: 5em;
text-decoration: none;
background-color: red;
}
<div class="my_content_container">
Go to my link location
</div>
Add background-color property in your css rule:
.my_content_container a {
border-bottom: 1px solid #777777;
border-left: 1px solid #000000;
border-right: 1px solid #333333;
border-top: 1px solid #000000;
color: #000000;
display: block;
height: 2.5em;
padding: 0 1em;
width: 5em;
text-decoration: none;
background-color: #fbca8e; /* <- Here */
}
How do I colorize my button in JavaScript?
Use style.backgroundColor property.
document.querySelector(".my_content_container > a").style.backgroundColor = "red";
.my_content_container a {
border-bottom: 1px solid #777777;
border-left: 1px solid #000000;
border-right: 1px solid #333333;
border-top: 1px solid #000000;
color: #000000;
display: block;
height: 2.5em;
padding: 0 1em;
width: 5em;
text-decoration: none;
}
<div class="my_content_container">
Go to my link location
</div>
href won't work in Chrome but it works on Microsoft Internet Explorer or Edge.
Looks like the line (a href="....html")Something(/a) is not working on edge or safari.
It is like dropdown menu.
There is a lot of code. You can check this problem here: http://www.kuhnibelarusi.lv . You will see 4 blue lines. Click on one of them and there will be the dropdown menu.
.dropdown {
position: relative;
border-radius: 0px;
}
.dropdown-menu {
top: 100%;
left: 0;
z-index: 1000;
float: inherit;
padding: 5px 0;
margin: 4px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 0px solid #ccc;
border: 0px solid rgba(0, 0, 0, .15);
border-radius: 0px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
}
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
}
.dropdown-menu>li>a:hover,
.dropdown-menu>li>a:focus {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}
.caret {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px dashed;
border-top: 4px solid \9;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
}
<li class="dropdown" style="list-style-type: none; padding: 5px; background-color: #3a4d5d; margin: 2px">Pakalpojumi <span class="caret"></span>
<ul class="dropdown-menu">
<li>Interjera dizains</li>
<li>Virtuves projektēšana</li>
</ul>
</li>
You are relying on default browser styles. As you have noticed, they are not reliable.
You also seem to be assuming href contains instructions how to style the elements - this is incorrect. href only defines the target url of the link.
If you want it to look in a specific way (turn blue, as you said), you have to use own css rules:
a,
a:link {
color: black;
}
a:hover {
color: blue;
}
a:visited {
color: red;
]
Strictly spoken, you only need the second part to make the link turn blue on hover, but if you don't define how it has to look before, you can again get different results in different browsers.
You need to tell Chrome and other browsers that you want a hover state for your 'a' tags, use CSS to do this...
.dropdown-menu li a {
color: red;
}
.dropdown-menu li a:hover {
color: blue;
}
you can also style :active and :visited
Try it out =]
I'm using Bootstrap 3 and am overriding .btn-primary with the following css to change the color a bit
.btn-primary {
color: #fff;
background-color: #337ab7;
border-color: #2e6da4
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary.focus,
.btn-primary:active,
.btn-primary.active,
.open>.dropdown-toggle.btn-primary {
color: #fff;
background-color: #286090;
border-color: #204d74
}
I'm trying to use this breadcrumb example but when I do, the arrow points (triangle bits) that separate the items are not the same color as the buttons. This happens on the normal state as well as the hover/active state.
What CSS properties do I need to edit to make these triangles the same color as my buttons?
.btn-primary {
color: #fff;
background-color: #337ab7;
border-color: #2e6da4
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary.focus,
.btn-primary:active,
.btn-primary.active,
.open>.dropdown-toggle.btn-primary {
color: #fff;
background-color: #286090;
border-color: #204d74
}
.btn-breadcrumb .btn:not(:last-child):after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 17px solid transparent;
border-bottom: 17px solid transparent;
border-left: 10px solid white;
position: absolute;
top: 50%;
margin-top: -17px;
left: 100%;
z-index: 3;
}
.btn-breadcrumb .btn:not(:last-child):before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 17px solid transparent;
border-bottom: 17px solid transparent;
border-left: 10px solid rgb(173, 173, 173);
position: absolute;
top: 50%;
margin-top: -17px;
margin-left: 1px;
left: 100%;
z-index: 3;
}
/** The Spacing **/
.btn-breadcrumb .btn {
padding: 6px 12px 6px 24px;
color: #fff;
}
.btn-breadcrumb .btn:first-child {
padding: 6px 6px 6px 10px;
}
.btn-breadcrumb .btn:last-child {
padding: 6px 18px 6px 24px;
}
/** Primary button **/
.btn-breadcrumb .btn.btn-primary:not(:last-child):after {
border-left: 10px solid #428bca;
}
.btn-breadcrumb .btn.btn-primary:not(:last-child):before {
border-left: 10px solid #357ebd;
}
.btn-breadcrumb .btn.btn-primary:hover:not(:last-child):after {
border-left: 10px solid #3276b1;
}
.btn-breadcrumb .btn.btn-primary:hover:not(:last-child):before {
border-left: 10px solid #285e8e;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<h2>Breadcrumb Primary</h2>
<div class="btn-group btn-breadcrumb">
<i class="glyphicon glyphicon-home"></i>
Snippets
Breadcrumbs
Primary
</div>
</div>
</div>
This is the CSS you need to use on normal state:
.btn-breadcrumb .btn.btn-primary:not(:last-child):after {
border-left: 10px solid #327CBA;
}
This is the CSS you need to use on hover state:
.btn-breadcrumb .btn.btn-primary:hover:not(:last-child):after {
border-left: 10px solid #286090;
}
Just find the definitions in your CSS file and replace it with the code above.You just need to change the colors for the normal state and hover state actually.
Just remove the arrows altogether
.btn.btn-primary:not(:last-child)::before,
.btn.btn-primary:not(:last-child)::after {
content: none;
}
Please visit the 'jsfiddle' Code, where the output can be seen. When hover displays the menu text, the background of the text field is transpernt + and lower zindex. I haven't set any transparency or zindex to the menu.
I have tried every possible technique to get it resolved but no luck.
.control-menu {
float: left;
width: 50px;
background-color: #F0F0F0;
height: 380px;
border-right: 1px solid #e0e0e0;
z-index: 100;
}
.control-menu ul {
list-style: none;
padding: 0;
margin: 0;
}
.btn {
position: relative;
display: block;
text-decoration: none;
background-color: #e0e0e0;
padding: 15px 20px 10px 20px;
text-align: center;
margin: 0 0 1px 0;
border-right: 1px groove #f00;
text-shadow: #666666 1px 1px 1px;
}
.btn-name {
display: none;
border-top: 1px solid #f0f0f0;
padding-top: 16px !important;
}
.btn:hover .btn-name {
display:inline;
background-color: #e0e0e0;
width: 100px;
padding: 17px 20px 12px 0;
margin: 0 0 1px 0;
border-right: 1px groove #f00;
}
.btn.active {
background-color: #F0F0F0;
border-bottom: 1px solid #f00;
}
.btn.active:hover .btn-name {
background-color: #F0F0F0;
border-bottom: 1px solid #f00;
}
can someone please guide solution?
just add
z-index:200
to the .btn, didn't change any positioning fiddle
just add position: relative; and z-index: 1000;
.btn:hover .btn-name {
display: inline;
background-color: #e0e0e0 !important;
width: 100px;
padding: 17px 20px 12px 0;
margin: 0 0 1px 0;
border-right: 1px groove #f00;
position: relative;
z-index: 1000;
}
in the btn:hover .btn-name add position relative and z-index: 1
.btn:hover .btn-name {
/* add this */
position: relative;
z-index: 1;
/* you code */
display: inline;
background-color: #e0e0e0 !important;
width: 100px;
padding: 17px 20px 12px 0;
margin: 0 0 1px 0;
border-right: 1px groove #f00;
}
here the fix : jsfiddle
Hi I want to make a menu button that should look like this when it is hovered:
But I made some thing that looks like this
You may notice the black border is not square as first image.
Here is my code (CSS):
#menu a:hover{
border-top: 5px solid #333333;
border-left: 5px solid #666666;
border-right: 5px solid #666666;
border-bottom: 5px solid #666666;
background-color: #666666;
color: #FFF;
}
try this, this will work.
#menu a:hover{
border-top: 5px solid #333333;
background-color: #666666;
color: #FFF;
}
#menu a{
border-top: 5px solid #333333;
background-color: #666666;
color: #FFF;
}
It might look a bit goofy without any padding.. so this is what I'd recommend. Stack overflow's pound symbol got cut out from the CSS signature
#menu a {
border-top: 5px solid #333333;
border-left: 5px solid #666666;
border-right: 5px solid #666666;
border-bottom: 5px solid #666666;
background-color: #666666;
padding: 5px 50px 5px 50px; /*<====================== added this*/
color: #FFF;
}
#menu a:hover {
border-top: 5px solid #333333;
border-left: 0px solid #666666; /*<========== changed this for hover effect*/
border-right: 5px solid #666666;
border-bottom: 5px solid #666666;
background-color: #666666;
padding: 5px 50px 5px 50px; /*<========================== added this*/
color: #FFF;
}
Tested in FF5 and IE8. Looks ok. The buttons are hyperlinks in white space.
But changes style on hover as you want.
#menu a:hover{
border-top: 5px solid #333;
background-color: #666;
padding: 0 5px 5px 5px;
color: #FFF;
}