473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Div id hyperlink help - div widths?

okay, im really not sure what to do here, as I've done the same thing before and it's worked perfectly but now ive tried to do the same thing again for another website and it's just not working...

okay, heres the problem:

i have:

[html]<!--site related navigation-->
<div id="mainnav">
<div id="title">
<a href="">Home</a><br />
<a href="">Staff</a><br />
<a href="">Affiliates</a><br />
<a href="">Affiliation</a><br />
<a href="">Link to Us</a><br />
<a href="">Site History</a><br />
<a href="">Past Layouts</a><br />
<a href="">About</a><br />

And in my CSS file i have:

Expand|Select|Wrap|Line Numbers
  1. #mainnav a
  2. {
  3. width: 100%;
  4. background-color: #583D21;
  5. text-align:right;
  6. text-decoration:none;
  7. color: #CCCC99;
  8. }
  9. #mainnav a:link
  10. {
  11. width: 100%;
  12. text-align:right;
  13. }
  14. #mainnav a:hover
  15. {
  16. width: 100%;
  17. background-color: #000000;
  18. text-align:left;
  19. color: #FFFFFF;
  20. }
  21. #mainnav a:visited
  22. {
  23. width: 100%;
  24. background-color: #583D21;
  25. text-align:right;
  26. }
Now this is meant to control the links in the "mainnav" div, right? and to some extent it does, with the exception of width. All of the background properties are fine, except the background does not stretch to 100% of the div width and just stays as long as the word it is the background to.
Just so you know the "mainnav" div is 200px wide so the link background should be 200px wide.

sorry if thats a bit hard to understand, this is my first post and im not really sure how to explain it.
is there something im missing? can anybody help me?
Oct 1 '07 #1
3 2642
7,435 Expert 4TB
<a> is an 'inline' element, meaning it is just like text in a paragraph and cannot be resized. If you want to control the width, in your css, add 'display:block' which makes it, obviously, block level, just like the div.
Oct 1 '07 #2
<a> is an 'inline' element, meaning it is just like text in a paragraph and cannot be resized. If you want to control the width, in your css, add 'display:block' which makes it, obviously, block level, just like the div.
hmm, thanks that has helped, but what i don't understand is how i managed to do it before without having to do anything like that. o well, thanks for your help though.

Now i just need to figure out how to getthe links directly underneath eachother becuase now ive put the 'display:block' each link it spaced out as if you've put an extra "<br />" in the code.
Oct 1 '07 #3
7,435 Expert 4TB
Remove the current <br>
Oct 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Lars G. Svensson | last post by:
As a regular ciwas reader, I learned that fixed-pixel designs are evil, so for the newly created site http://www.ddc-deutsch.de (in German, still very much under construction) I arranged the...
by: Steve Sabljak | last post by:
I seem to having a little trouble getting a table to display correctly in both msie and firefox. I want to set the table and column widths in pixels, and have some cell padding too. The table...
by: TJ Talluto | last post by:
<facts> I have a "month calendar" that always displays exactly 42 days... and alongside is a vertical box that displays the detail (form fields) of any particular select event that appears on the...
by: Badboy36 | last post by:
Hello user from googlegroups, i made a microsoft access database with front and backend. i created the backend in microsoft access97. for the frontend i made two versions (one for microsoft...
by: Ryan Harvey | last post by:
Hi all, I have written a web user control that contains a repeater control. the ItemTemplate for this control is basically 6 Hyperlinks in a row, that are dynamically allocated one of 7 gif...
by: Martin Dew | last post by:
Having some problems getting a hyperlink object to work in my repeater control, It displays the text I have asked it to for the hyperlink, but it does not act as a link. My repeater code is below...
by: david | last post by:
Hi, all: I need a help from you about DataGrid control. I created a DataGrid, dg, in design view of .NET visual Stadio and use the builder to add a Hyperlink column to dg. I want to try to assign...
by: Midsomer | last post by:
Hi. I have an Access database with a form containing 4 datasheets and I allow the user to change column widths. On closing the form, a routine is fired that saves each column width to an INI file....
by: tshad | last post by:
I had posted this problem earlier and just noticed that the Hyperlink is the problem. Apparently, it doesn't figure out the path correctly. It uses the path of the file it is in, even if it is...
by: Markus | last post by:
Ello. I'm trying to set the widths for my first three rows of cells and then have a bottom row with different cell widths. However, the first three rows take on the same widths as the bottom row. ...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.