css background repeat is not working - css

I have a css class called navigation which will hold some link and when i'll add some extra link it will go from left to right and then again it'll come to bottom of the LHS. i use background-repeat: repeat-y; and height:auto; but the image is not repeating instead of a white background is coming. I'm working on IE8. the css codes are given below:
#navigation {
background: url(../images/custom/lite/navigation_bg.gif);
border-top: 7px solid #455660;
height: auto;
background-repeat:repeat-y;
}
#navigation ul,
#add-page {
float: left;
}
#navigation a {
color: #FFF;
display: block;
font: 14px/56px Arial,Helvetica,sans-serif;
font-weight:bold;
height: 50px;
padding: 0 24px;
text-decoration: none;
}
#navigation a:hover {
color: #000;
}
#navigation .selected a {
color:#000
}
#navigation .selected a {
font-size: large;
text-transform: uppercase;
}

#reuben, you given float in your ul so you have clear it #navigation
like this:
#navigation {
overflow:hidden;
}
may that's help you

What does your HTML look like? You say you have a class called navigation but your selector syntax is that of an ID.
For your CSS to work as shown here, you should have something like
<div id="navigation">...</div>

change your css to the below:
.navigation {
background: url(../images/custom/lite/navigation_bg.gif);
border-top: 7px solid #455660;
height: auto;
background-repeat:repeat-y; }
.navigation ul,
#add-page {
float: left; }
.navigation a {
color: #FFF;
display: block;
font: 14px/56px Arial,Helvetica,sans-serif;
font-weight:bold;
height: 50px;
padding: 0 24px;
text-decoration: none; }
.navigation a:hover {
color: #000; }
.navigation .selected a {
color:#000 }
.navigation .selected a {
font-size: large;
text-transform: uppercase; }

Related

Nav inside Header, Position Fixed?

I have an header with 100% width, and a nav inside header with 980px
Now i want to give the position as fixed for both header and nav.
I have tried with the following code but could'nt get what i wanted to
Please help me,
my header.css
width:100%;
height:60px;
background: #ffffff;
position:fixed;
z-index:999;`
and my nav.css
background: #ffffff;
height: 60px;
text-align:center;
position:fixed;
z-index:99;
.nav ul
margin:0;
padding:0;
.nav li
display: inline-block;
list-style-type: none;
vertical-align:middle;`
.nav li a
font-size: 16px;
color: black;
display: block;
line-height: 60px;
padding: 0 10px;
text-decoration: none;
If the nav is inside the header you don't need position:fixed in your nav.css, you should also remove the z-index. A clearer description of the problem and the html you're using would be helpful if that doesn't help.
#Fastnto, it's something like this that you want?
http://jsfiddle.net/alexandrecanijo/NBp8F/
I've changed some parts of your original CSS in order to show the header (#ccccccc) and nav (#000000) and added the .content with enough lorem ipsum so that you are able to see the nav.
But, the CSS might be cleaned and refactored in some parts... Didn't had a change to do this...
Hope this helps.
html,body, p {
margin: 0;
padding: 0;
border: 0;
font: 14px arial;
}
.header {
width: 100%;
height: 80px;
background: #cccccc;
position: fixed;
z-index:999;
margin: 0;
clear: both;
top: 0;
}
.nav {
background: #000000;
height: 60px;
text-align:center;
z-index:99;
}
.nav ul {
margin:0;
padding:0;
}
.nav li {
float: left;
list-style-type: none;
}
.nav li a {
font-size: 16px;
color: #fe6700;
display: block;
line-height: 60px;
padding: 0 10px;
text-decoration: none;
}
.nav li a:hover {
color: #000000;
background: #fe6700;
}
.content {
margin-top: 80px;
}

How to change the style of horizontal menu

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.

IE 8 floating issue with responsive design

IE only knows how to make smokers who've just quite, smoke again!!
I'm trying to perfect this responsive Navigational Menu (as well as another website I've developed) to RESPOND with IE8 (i'm not sure what the NAV looks like in www.testing123.co.za/test1.htm
when I re-size the my browser window, it seems like the NAV is ignoring my media queries OR IE8 is not liking the float involved in this design. I seem to think it's the latter.
I've done some research and have hear that this should be included in your page for the media queries to be applied, but I still have no luck when including the js file. I'm not sure what I've probably done wrong here?
I included the js file like so:
<script src="css3-mediaqueries.js"></script>
Anyway, I'd appreciate some clarification at what must be done to correct IE 8 Float problems (assuming this is the issue).
Appreciate your help, thanks
CSS goes like:
nav {
width: 90%;
margin: 0px auto;
}
nav ul {
list-style: none;
overflow: hidden;
}
nav li a {
background: #444;
border-right: 1px solid #fff;
color: #fff;
display: block;
float: left;
font: 100 24px/1.4 TrumpGothicWestRegular;
padding: 10px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
width: 12.5%;
min-height:80px;
padding-top:60px;
}
nav li a img { padding-bottom:5px; display:block; margin: 0px auto; }
/*SMALL*/
nav small {
color: #aaa;
font: 100 11px/1 Helvetica, Verdana, Arial, sans-serif;
text-transform: none;
}
nav li a:hover {
background: #222;
}
nav li:last-child a {
border: none;
}
Viewports under 1100px (small-device1100.css):
nav li a {
font: 100 21px/1.4 TrumpGothicWestRegular;
min-height:inherit;
padding: 10px;
}
nav small {
font: 100 8px/1 Helvetica, Verdana, Arial, sans-serif;
}
nav li a img { display:none; }
Viewports under 825px (small-device825.css):
nav li a {
width: 33.333333333333333333333333333333%;
border-bottom: 1px solid #fff;
font: 100 24px/1.4 TrumpGothicWestRegular;
}
nav li:last-child a, nav li:nth-child(3) a {
border-right: none;
}
nav li:nth-child(4) a, nav li:nth-child(5) a, nav li:nth-child(6) a {
border-bottom: none;
}
Viewports under 350px (small-device350.css):
nav li a {
width: 50%;
font: 400 21px/1.4 TrumpGothicWestRegular;
padding-top: 12px;
padding-bottom: 12px;
}
nav li:nth-child(even) a {
border-right: none;
}
nav li:nth-child(3) a {
border-right: 1px solid #fff;
}
nav li:nth-child(4) a, nav li:nth-child(5) a {
border-bottom: 1px solid #fff;
}

Element inherits wrong style

I have a huge amount of elements in my website... And since I added the following css... Some elements inherit from these css styles... While they don't have anything to do with it: other scope, no direct definition to the css style etc... What am I doing wrong?
#InformationForDiv
{
width: 205px;
height: 180px;
background: #FFFFFF;
clear: both;
float: left;
margin: 0 35px 0 35px;
text-align: center;
}
#InformationForDiv ul
{
text-align: left;
padding: 0px;
display:block;
}
#InformationForDiv li
{
border-bottom: solid 1px #D6D6D6;
padding: 0px;
list-style: none;
line-height: 20px;
display: block;
}
#InformationForDiv p
{
display:inline;
float:right;
margin:0;
text-align:right;
font-size: 16px;
color: #B02229;
}
#InformationForDiv li a:link, a:visited
{
color: #544B42;
text-decoration: none;
font-size: 12px;
width:100%;
display:block;
}
#InformationForDiv li a:hover
{
color: #544B42;
border-bottom: 1px solid #544B42;
font-size: 12px;
}
#InformationForDiv li a:visited
{
color: #544B42;
text-decoration: none;
font-size: 12px;
}
#InformationForDiv img
{
margin: 10px 0 5px 0;
}
At least this one:
#InformationForDiv li a:link, a:visited
will select all a:visited elements and it doesn't look like your intention.
Perhaps because those elements have an ancestor in the HTML document in which they exist that has the ID "InformationForDiv".
Its generally not a good idea to include in an external css selectors the use of specific element IDs. External CSS ought to rely on class names to select appropriate elements.

Help with CSS positioning

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;
}

Resources