I have got a task to do horizontal menu. While creating the menu i got a problem with the style.When we are hovering the menu it is jumping and also the sub child menu is comes at different position depending on the size of the text. My css file is
#wrapper {
width:100%;
height:500px;
}
h2 {
color:#787878;
}
#menu, #menu ul {
list-style: none;
//padding: 2px;
}
#nav{
border-bottom: 1px solid #CCCCCC;
border-spacing: 0;
display: table;
float: left;
height: 25px;
width: 100%;
}
#nav ul {
margin: 0;
padding: 0;
}
#nav > ul > li:hover {
background: none repeat scroll 0 0 #FFFFFF;
border-color: #ccc #ccc #FFFFFF;
border-style: solid;
border-width: 1px;
padding-bottom: 0;
border-radius:1px;
}
.menu-child {
width:160px;
display:block !important;
}
#nav ul li ul li:hover {
}
#nav ul li ul :hover {
}
#menu {
float: left;
height: 25px;
}
#menu> li {
float: left;
}
#menu li a {
display: block;
height: 2em;
line-height: 2em;
padding: 0 1.5em;
text-decoration: none;
}
#menu ul {
position: absolute;
display: none;
z-index: 999;
}
#menu ul li a {
}
#menu li:hover ul {
display: block;
}
#menu {
font-family: Arial;
font-size: 12px;
//background: #F8F8F8;
}
#menu > li > a {
font-family: Verdana, Arial, sans-serif;
font-style: normal;
color:#787878;
font-weight: bold;
}
#menu > li > a:hover {
color: #000;
}
#menu ul {
background: none repeat scroll 0 0 #FFFFFF;
border-radius: 0 0 5px 5px;
margin-top: 1px;
}
#menu ul li a {
color: #000;
}
#menu ul li a:hover {
background: #E0E0E0;
}
.logout {
float:right;
width:300px;
}
.title {
float:left;
width:300px;
}
#footer {
width:100%;
height:100px;
float:left;
}
.subchild-list {
margin:0;
position: absolute !important;
top:0;
right:-87px;
//border-color: #ccc #FFFFFF #ccc #FFFFFF;
}
.child-list ul {
display: none !important;
position: absolute !important;
z-index: 999 !important;
}
.child-list li {
position:relative !important;
}
.child-list li:hover ul {
display: block !important;
}
.child-list li{
border-left:1px solid #C0C0C0;
border-right:1px solid #C0C0C0;
}
.child-list ul{
border-top:1px solid #C0C0C0;
border-bottom:5px solid #C0C0C0;
}
.child-list{
border-bottom:5px solid #C0C0C0;
}
.nav-subchild
{
border-color: #ccc #FFFFFF #ccc #FFFFFF;
}
You can see my code from http://jsfiddle.net/ucpcA/1/ How can i solve this problem?
Add to css this:
li {border: 1px solid #fff;}
I tried it in fiddle and it solved "jumping"
//Edit
The main idea is to set border to the top li elements so when you add additional border with color it will not jump
//Edit 2 to solve your 2nd problem
To sovle your 2nd prbolem put this line
.subchild-list {
margin:0;
right:-150px;
position: absolute !important;
top:0; }
#menu ul li {width: 150px;}
It is just an example so you will see what it does. Put there the ewidth which you really need.
Related
How can I remove the white border under the tag from this drop down menu? I only want it to appear when the drop down item is hovered.
Please see for the website. www.velnikolic.com/music Need to type more for limit to go down.
Current CSS
/* Navigation --------------------------------------- */
.main-menu li {
display: block;
font-weight: 10000;
text-transform: uppercase;
letter-spacing: 2px;
position: relative;
text-align:center;
padding:15px 70px;
margin-bottom:1px;
}
.main-menu li:hover {
display: block;
background:black;
color:white;
}
.main-menu li:hover a{
color:white;
border-bottom: 2px solid white;
}
ul.main-menu a {
margin-left: 0px;
text-align: center;
}
.main-menu > li:first-child { margin-top: 0; }
.main-menu ul { margin-left: 20px; }
.main-menu a { color: #999;
text-align:center;
}
.main-menu li a:hover,.main-menu li a:focus {
color:white;
}
.main-menu .current-menu-item > a,
.main-menu .current_page_item > a { color: white; }
li.current-menu-item{
background:black;
color:white;
}
.main-menu .current-menu-item:before,
.main-menu .current_page_item:before {
/*content: '\f405';
display: block;
font: 16px/1 "Genericons";
color: #019EBD;
position: absolute;
top: -1px;
left: -20px;*/
}
/* -------------------------------------------------------------------------------- */
/* User-Added-1. Drop Down Menu
/* -------------------------------------------------------------------------------- */
ul.sub-menu{
display: none;
}
li:hover .sub-menu {
background: #34495e;
border: #fff solid;
border-width: 1px;
display: block;
position: absolute;
left: 180px;
top: -1px;
}
you must be talking about text decoration property
try this :
text-decoration:none;
possible values are:
none
underline
overline
line-through
This should work:
ul.main-menu a
{
border-bottom: 0;
}
ul.main-menu a
{
border-bottom: 2px solid white;
}
EDIT: Try
Changing .main-menu li:hover a to .main-menu li:hover > a
and add the following:
.main-menu li:hover a
{
color: white;
}
My navigation bar works perfectly fine, any image links work fine, but all text links on my page jump down when I click on them. Most of them jump so far you cannot actually click it.
I also noticed my a:visited links are inheriting the color #000 from somewhere, when they should be #616161. There is no issue when browsing on my Android device, but happens in IE11 and Chrome32.
The HTML is nothing special. Just
Page Name
type links. It has to be something with the CSS.
The CSS:
body {
background-color: #7296d9;
max-width:1000px;
}
#wrapper {
width:auto;
background:url(../images/bg.jpg);
background-repeat:repeat;
margin:4px;
}
#content {
width:98%;
text-align:center;
margin:auto;
}
#paragraph {
width:80%;
font-size:18px;
color: #666;
font-weight:100;
text-align:justify;
margin:10px auto 25px auto;
}
.reviews {
width:80%;
margin:auto;
text-align:justify;
color: #666;
}
p {
margin:10px 0 10px 0;
}
h1 {
line-height:48px;
font-size:36px;
font-weight:bold;
text-align:center;
margin-top:10px;
}
h2 {
line-height:42px;
font-size:24px;
font-weight:bold;
text-align:center;
}
a:link, a:visited {
color: #616161;
text-decoration: underline;
}
a:hover, a:active {
color: #ffffff;
text-decoration: underline;
}
#header {
height:86px;
max-height:86px;
width:98%;
min-width:500px;
position:relative;
background-image:url(../images/logo.png);
background-repeat:no-repeat;
}
#header .left {
float:left;
height:auto;
}
#header .media-header {
float:right;
margin-top:50px;
margin-right:-20px;
}
#menu ul li:hover > ul {
display: block;
}
#menu {
display:table;
width:100%;
background: -webkit-linear-gradient( #d5d5d5, #595959); /* For Safari */
background: -o-linear-gradient( #d5d5d5, #595959); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient( #d5d5d5, #595959); /* For Firefox 3.6 to 15 */
background: linear-gradient( #d5d5d5, #595959); /* Standard syntax */
-webkit-border-radius: 25px;
-o-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
}
#menu ul ul {
display: none;
}
#menu ul {
height:auto;
font-size: 16px;
font-family: "Times New Roman", Times, serif;
font-weight: bold;
text-align: center;
text-shadow: 2px 2px 2px #cccccc;
text-decoration:none;
list-style: none;
position: relative;
display: table-row;
}
#menu a:link, a:visited {
display:block;
text-decoration: none;
color: #000000;
padding: 8px auto 8px auto;
}
#menu a:hover, a:active {
display:block;
padding:5px;
text-decoration:none;
color: #fff;
}
#menu ul:after {
content: "";
clear:both;
display: block;
}
#menu ul li {
display:table-cell;
width:auto;
}
#menu ul a:link, a:visited {
display: block;
padding: 5px;
color: #000;
text-decoration: none;
}
#menu ul a:hover, a:active {
display:block;
padding:5px;
text-decoration:none;
color: #fff;
}
#menu ul ul {
background: #999;
border-radius: 0px;
padding: 0;
position: absolute;
}
#menu ul ul li {
width:auto;
border-top: 1px solid #ccc;
position: relative;
display:block;
}
#menu ul ul li a {
padding: 5px;
text-align:left;
color: #000;
}
#menu ul ul li a:hover {
color: #FFF;
}
#menu ul ul:last-child, nav ul ul:last-child a {
-webkit-border-bottom-right-radius: 10px;
-o-border-bottom-right-radius: 10px;
-moz-border-radius-bottomright: 10px;
border-bottom-right-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
-o-border-bottom-left-radius: 10px;
-moz-border-radius-bottomleft: 10px;
border-bottom-left-radius: 10px;
}
.center {
text-align:center;
}
#reviews {
width:80%;
text-align:justify;
overflow:hidden;
margin:25px auto 25px auto;
}
#reviews img {
position:relative;
float:left;
}
#form {
color: #666;
margin:0px auto 0px auto;
width:350px;
}
#form p {
color: #666;
margin:0px auto 0px auto;
width:350px;
}
.bottombar {
margin:auto;
width:100%;
}
#footer {
display:block;
font-size:12px;
color: #616161;
text-align:center;
width:auto;
margin:5px auto 5px auto;
}
#footer img {
text-align:center;
color: #616161;
width:100%;
margin:5px auto 5px auto;
}
#media-footer {
text-align:center;
margin:10px 0 15px 55px;
}
#media-footer img {
text-align:center;
margin:10px 0 15px 55px;
}
nav ul {
display:none;
}
#minimenu {
display:none;
}
It's because you are adding padding to the element when it is :active:
#menu ul a:hover, a:active {
display: block;
padding: 5px;
text-decoration: none;
color: #fff;
}
It's worth noting that you are repeating the same styling in different instances.
#menu a:hover, a:active {
display: block;
padding: 5px;
text-decoration: none;
color: #fff;
}
Just remove the padding from both declarations and it will work as expected.
I have got a task to create menu. Here I want to set an arrow image to menu when selecting its submenu. I did an example with this image.But I want to delete that image from that onload and show it when we selects its submenu. Only the selected menus image should be displayed.
My css file is
#menu {
font-family: Arial;
font-size: 12px;
//background: #F8F8F8;
}
#menu > li > a {
font-family: Verdana, Arial, sans-serif;
font-style: normal;
color:#787878;
font-weight: bold;
}
#menu > li > a:hover {
color: #000;
}
#menu ul {
background: none repeat scroll 0 0 #FFFFFF;
border-radius: 0 0 5px 5px;
margin-top: 1px;
}
#menu ul li a {
color: #000;
}
#menu ul li a:hover {
background: #E0E0E0;
}
.logout {
float:right;
width:300px;
}
.title {
float:left;
width:300px;
}
#footer {
width:100%;
height:100px;
float:left;
}
.subchild-list {
margin:0;
position: absolute !important;
top:0;
right:-87px;
//border-color: #ccc #FFFFFF #ccc #FFFFFF;
}
.child-list ul {
display: none !important;
position: absolute !important;
z-index: 999 !important;
}
.child-list li {
position:relative !important;
}
.child-list li:hover ul {
display: block !important;
}
.child-list li{
border-left:1px solid #C0C0C0;
border-right:1px solid #C0C0C0;
}
.child-list ul{
border-top:1px solid #C0C0C0;
border-bottom:5px solid #C0C0C0;
}
.child-list{
border-bottom:5px solid #C0C0C0;
}
.nav-subchild
{
border-color: #ccc #FFFFFF #ccc #FFFFFF;
}
#nav > ul > li:hover {
border-color: #ccc #ccc #FFFFFF;
border-style: solid;
border-width: 1px;
padding-bottom: 0;
border-radius:1px;
}
#menu > li {
border-bottom:#ccc;
border-left: 1px solid #fff;
border-right: 1px solid #fff;
border-top: 1px solid #fff;
}
#nav ul li:hover ul { margin-left:-1px; } #nav ul li ul:hover { margin-left:-1px; }
ul li ul li
{
width: 180px;
}
.subchild-list {
margin:0;
right:-183px;
position: absolute !important;
top:0;
}
.hassub {
background: url('arrow.gif') right no-repeat;
}
#menu li:hover > a {
color: #000;
font-weight:bold;
}
How can I solve this problem?
Now just define this css
#menu .child-list > li:hover > a {
background: #E0E0E0 url(http://www.coeliac.org.uk/sites/coeliac.org.uk/themes/coeliac/images/icon_arrow_small_right.gif) right no-repeat;
}
Live Demo
Have a look at this ..
#menu ul li a:hover {
background:url(http://www.coeliac.org.uk/sites/coeliac.org.uk/themes/coeliac/images/icon_arrow_small_right.gif) right no-repeat #E0E0E0;
}
Live Demo
This are the few changes
#menu ul li a:hover {
// background: #E0E0E0;
background:url(http://www.coeliac.org.uk/sites/coeliac.org.uk/themes/coeliac/images/icon_arrow_small_right.gif) right no-repeat;
}
.hassub {
// background: //url(http://www.coeliac.org.uk/sites/coeliac.org.uk/themes/coeliac/images/i//con_arrow_small_right.gif) right no-repeat;
}
Live Demo
I have got a task to create menu. I want to set the menu as selected while selecting its subchild. My css file is
#wrapper {
width:100%;
height:500px;
}
h2 {
color:#787878;
}
#menu, #menu ul {
list-style: none;
//padding: 2px;
}
#nav{
border-bottom: 1px solid #CCCCCC;
border-spacing: 0;
display: table;
float: left;
height: 25px;
width: 100%;
}
#nav ul {
margin: 0;
padding: 0;
}
#nav > ul > li:hover {
background: none repeat scroll 0 0 #FFFFFF;
border-color: #ccc #ccc #FFFFFF;
border-style: solid;
border-width: 1px;
padding-bottom: 0;
border-radius:1px;
}
.menu-child {
width:160px;
display:block !important;
}
#nav ul li ul li:hover {
}
#nav ul li ul :hover {
}
#menu {
float: left;
height: 25px;
}
#menu> li {
float: left;
}
#menu li a {
display: block;
height: 2em;
line-height: 2em;
padding: 0 1.5em;
text-decoration: none;
}
#menu ul {
position: absolute;
display: none;
z-index: 999;
}
#menu ul li a {
}
#menu li:hover ul {
display: block;
}
#menu {
font-family: Arial;
font-size: 12px;
//background: #F8F8F8;
}
#menu > li > a {
font-family: Verdana, Arial, sans-serif;
font-style: normal;
color:#787878;
font-weight: bold;
}
#menu > li > a:hover {
color: #000;
}
#menu ul {
background: none repeat scroll 0 0 #FFFFFF;
border-radius: 0 0 5px 5px;
margin-top: 1px;
}
#menu ul li a {
color: #000;
}
#menu ul li a:hover {
background: #E0E0E0;
}
.logout {
float:right;
width:300px;
}
.title {
float:left;
width:300px;
}
#footer {
width:100%;
height:100px;
float:left;
}
.subchild-list {
margin:0;
position: absolute !important;
top:0;
right:-87px;
//border-color: #ccc #FFFFFF #ccc #FFFFFF;
}
.child-list ul {
display: none !important;
position: absolute !important;
z-index: 999 !important;
}
.child-list li {
position:relative !important;
}
.child-list li:hover ul {
display: block !important;
}
.child-list li{
border-left:1px solid #C0C0C0;
border-right:1px solid #C0C0C0;
}
.child-list ul{
border-top:1px solid #C0C0C0;
border-bottom:5px solid #C0C0C0;
}
.child-list{
border-bottom:5px solid #C0C0C0;
}
.nav-subchild
{
border-color: #ccc #FFFFFF #ccc #FFFFFF;
}
#nav > ul > li:hover {
border-color: #ccc #ccc #FFFFFF;
border-style: solid;
border-width: 1px;
padding-bottom: 0;
border-radius:1px;
}
#menu > li {
border-bottom:#ccc;
border-left: 1px solid #fff;
border-right: 1px solid #fff;
border-top: 1px solid #fff;
}
#nav ul li:hover ul { margin-left:-1px; } #nav ul li ul:hover { margin-left:-1px; }
ul li ul li
{
width: 180px;
}
.subchild-list {
margin:0;
right:-183px;
position: absolute !important;
top:0;
}
.hassub {
background: url('arrow.gif') right no-repeat;
}
How can i solve this problem?
try this
font-weight:bold;
If I understand your question right, you want the top level navigation to have an active state even on a sub level hover.
In that case, here's the answer (append to your CSS):
#menu li:hover > a {
color: #000;
}
Jsfiddle: http://jsfiddle.net/wDcV5/2/
This is my page:
link
As you can see on the screen shot, the icons (red circle) are not aligned with icons above it (click on title to expand it).
alt text http://img338.imageshack.us/img338/1390/35070527.jpg
The CSS:
body
{
font-family: arial, helvetica, sans-Serif;
}
#talkbacks .noshow
{
overflow:hidden;
clear:both;
padding: 2px 10px;
}
#talkbacks ul.top
{
border: solid 1px #fff;
margin: 0 -1px;
}
#talkbacks li
{
width: 100%;
/*margin-top: 5px;*/
}
/*
#talkbacks ul
{
clear: both;
}*/
.n
{
color: #758888;
float: left;
font-size: 12px;
padding-right: 8px;
line-height: 15px;
width:15px;
}
.c
{
float: left;
/*width: 400px; */
width:92%;
margin-top: 0px;
margin-right:5px;
}
.d
{
font-weight: bold;
color: #758888;
font-size: 12px;
line-height: 15px;
margin: 0;
padding: 0;
}
ul
{
list-style-image: none;
list-style-position: outside;
list-style-type: none;
padding-left:0px;
margin-left:0px;
margin-top:5px;
margin-bottom:5px;
clear:both;
}
a
{
font-size: 12px;
line-height: 15px;
font-weight: bold;
}
a:link, a:visited
{
color: #284D99;
text-decoration: none;
outline: none;
}
a:hover, a:active
{
text-decoration: underline;
}
li ul li div.c
{
padding-left: 26px;
}
li ul li ul li div.c
{
padding-left: 52px;
}
li ul li ul li ul li div.c
{
padding-left: 77px;
}
li ul li ul li ul li ul li div.c
{
padding-left: 104px;
}
#talkbacks .noshow .userpanel
{
display: none;
}
#talkbacks .noshow .adminpanel
{
display:none;
}
#talkbacks .noshow div.CommentBody, .show div.CommentBody p
{
display: none;
}
/*************** Show Comment **********************/
#talkbacks .show
{
background: #F3F3F3 none repeat scroll 0 0;
border-bottom: 1px solid #B6C7C7;
border-top: 1px solid #B6C7C7;
display: table;
font-size: 12px;
padding: 11px 10px;
width: 439px;
}
/*#talkbacks .show p
{
font-size: 1em;
}*/
#talkbacks .show div.CommentBody, .show div.CommentBody p
{
display: block;
margin: 1.5px 0 0 0;
font-size: 12px;
}
#talkbacks .show .userpanel
{
margin-top: 10px;
display:block;
}
#talkbacks .show .userpanel .votes div.voteResult
{
background-color: #FFFFFF;
border: 1px solid #EBEBEB;
color: #555555;
float:left;
font-weight: bold;
padding: 0 4px;
font-size: 11px;
}
#talkbacks .show .userpanel div.reply
{
float:left;
}
#talkbacks .show .userpanel .votes div.buttons
{
float:left;
}
/*************************** Add new comment **********************************/
#NewComment .textBox
{
border: 1px Solid #002080;
overflow:auto;
}
.linka
{
cursor: pointer;
cursor: hand;
}
The problematic part is this one(i think):
li ul li div.c
{
padding-left: 26px;
}
li ul li ul li div.c
{
padding-left: 52px;
}
I want to move the div "c", to the right without shifing the userpanel with the icons.
you could do this a easy way.
<div class="commentcontainer">
......
<div class="updown">....</div>
......
</div>
style :
.commentcontainer{position:relative;}
.commentcontainer .updown {position:absolute; top:20px; right:20px;}
this should work. sorry i used other classes and stuff..
the main ideea is: put position:relative; in the css of the commentbox and put position:absolute; top:20px; right:20px; in the css of the up/down vote this should put your up/down vote img`s in the same spot in all comments.
Or if this does not work you should check the width of the commentbox`s if it has a defined value.. try to put : width:100%;
Hope it helps
The problem is you are setting the width to 92% of its container then adding 52px of padding onto that. That is making the layout something like this:
|26px| LEVEL 1 |
| | 92% |
| 52px | LEVEL 2 |
| | 92% |
As the icons are aligned to the right, they are now offset as the right edge is further across. I would recommend not setting the width of the div and instead using margins to align them, something like this:
|26px| LEVEL 1 |
| | |
| 52px | LVL2 |
| | |
As a tip for debugging these sorts of issue, put borders on everything of different colours. This would probably have made what is happening more obvious as you would "see" it.
Tested in FF3
#talkbacks .show
{
-moz-background-clip:border;
-moz-background-inline-policy:continuous;
-moz-background-origin:padding;
background:#F3F3F3 none repeat scroll 0 0;
border-bottom:1px solid #B6C7C7;
border-top:1px solid #B6C7C7;
font-size:12px;
overflow:hidden;
padding:11px 10px;
position:relative;
width:439px;
}
div.votes
{
float:none !important;
position:absolute;
right:20px;
}