Web Design Forums

HTML and CSS Help

Having problems with these web design scripting? Ask here.

CSS background repeat and containers



Site of the Month Nominations
ENTER YOUR SITE NOW!

Reply
 
LinkBack Thread Tools
Old June 26 '09, 04:25 PM (#1)
particlepat is offline
New Member!
 
particlepat's Avatar
 
Join Date: June 2009
Posts: 2
particlepat is an unknown quantity at this point
CSS background repeat and containers

hello internet,

I'm trying to create a nav bar that is 900px wide but has a background image that is repeated across the entire screen so that it appears the navbar spans across the entire screen. right now my html looks something like this:
Code:
<container4>
     <div id="top_navlist">
          <div id="bcsprosoftnavlogo">
          <img src="Images/bcsprosoftnavlogo.jpg" width="166" height="25" alt="logo" longdesc="Images/bcsprosoftnavlogo.jpg" />
          </div>
                    <ul id="navlist">
                         <li><a href="#">home</a></li>
                         <li><a href="#">who we are</a></li>
                         <li><a href="#">what we do</a></li>
                         <li><a href="#">products</a></li>
                         <li><a href="#">news &amp; events</a></li>
                         <li><a href="#">contact us</a></li>
                         <li><a href="#">get connected</a></li>
                     </ul>
     </div><!--TOP_NAVLIST-->
</container4>
Container 4 is in it's own container, seperate of the container that holds the rest of the content because I want the other stuff to stay at 900px. container4 will have a nav bar that is 900px wide, but the background image will be repeated across the width of the screen.

here is the css I have for container 4 and the top_navlist:

Code:
#container4{
    font-size: 0.75em; /* 16x0.75=12px */
    font-family: "Trebuchet MS", Geneva, Verdana, sans-serif, Arial, Georgia, Times New Roman, Times;
    height: 50px;
    background-image: url(Images/navbarbg.jpg);
    background-repeat: repeat-x;
    border: 1px solid #00E;
    margin: 0 auto;
    position: absolute;
    top: 0px;
    float: none;
}

#top_navlist {
    margin: 0 auto;
    position: absolute;
    top: 0px;
    width: 900px;
    height: 50px;
    text-align: right;
    background-image: url(Images/navbar.jpg);
    float: none;
}
at the moment the navbar is floating left and there is no background image. does anyone have any suggestions?

Last edited by Wired; June 27 '09 at 12:27 AM. Reason: fixed bbcode
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 26 '09, 06:28 PM (#2)
particlepat is offline
New Member!
 
particlepat's Avatar
 
Join Date: June 2009
Posts: 2
particlepat is an unknown quantity at this point
i've managed to get everything centered however now i cannot get it to anchor to the top. it is about 20px from the top of the screen. this is what i'm working with now:

Code:
#container4 {
    font-size: 0.75em; /* 16x0.75=12px */
    font-family: "Trebuchet MS", Geneva, Verdana, sans-serif, Arial, Georgia, Times New Roman, Times;
    height: 50px;
    width: 100%;
    background-image: url(Images/navbarbg.jpg);
    background-repeat: repeat-x;
    position: absolute;
    top: 0px;
}

#top_navlist {
    margin: 0 auto;
    top: 0px;
    width: 900px;
    height: 50px;
    text-align: right;
    background-image: url(Images/navbar.jpg);
}

Last edited by Wired; June 27 '09 at 12:25 AM. Reason: fixed bbcode
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 28 '09, 07:59 PM (#3)
imagn is offline
WDF Regular
 
imagn's Avatar
 
Join Date: July 2007
Location: Los Angeles
Posts: 156
imagn will become famous soon enough
First off you should use the "background" property so you can lose the "-image", "-repeat" ect. This will also default the image to top left of the browser unless you specify a value:

background: url(Images/navbarbg.jpg) repeat-x;
same as
background: url(Images/navbarbg.jpg) repeat-x top left;

If you need it 20 pixels from the top you would use:

background: url(Images/navbarbg.jpg) repeat-x 20px 0px;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

  Web Design Forums » Programming Help » HTML and CSS Help

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A problem with CSS PipBoy HTML and CSS Help 9 January 6 '09 01:00 AM

 
User Infomation
Your Avatar

Site Of The Month

Ticket Cake
Ticket Cake

Ticket Cake is a drupal based event ticketing platform. It features that ability to browse events and share them.

Nominate Your Site Now!

Advertisement
WolfCMS.org

Latest Articles
- by RickM
- by bfsog

Advertisement

Partner Links



All times are GMT -4. The time now is 02:37 AM.


WebDesignForums.net is Copyright © 2010 RikeMedia.

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163