473,803 Members | 3,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Div id hyperlink help - div widths?

2 New Member
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">
.site&nbsp;
</div>
<a href="">Home</a><br />
<a href="">Staff</a><br />
<a href="">Affilia tes</a><br />
<a href="">Affilia tion</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 />
</div>[/html]

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 2667
drhowarddrfine
7,435 Recognized Expert Expert
<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
RJReelar
2 New Member
<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
drhowarddrfine
7,435 Recognized Expert Expert
Remove the current <br>
Oct 1 '07 #4

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

Similar topics

3
6595
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 content (left) and the menu (right) (ideas stolen from bluerobot.com) using percentage widths (75% content, 25% menu). This looks nice in Opera 7.11 but in IE 6, content and menu are overlapping. When reading the following, please keep in mind, that...
3
10715
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 displays correctly in standards compiance mode in firefox, but not msie, where the padding is added on to the column widths. the table size is always correct, but the column widths are not what I expect them to be. If I change the column widths to...
0
2630
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 calendar, so that the event may be changed, or a new event may be created. monthname X X X X X X X form X X X X X X X form X X X X X X X form
1
3389
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 access 97 and the other one for microsoft acess 2000/2002). my problem is in a field with a hyperlink , which i selected in a table. this hyperlink refer to microsoft word documents on our intranet. i enter the hyperlink in a formular (right...
0
550
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 images as the ImageURL of the Hyperlink. When a load the page with the controls on it works fine, but sometimes the images are broken, but if i hit refresh i get random selections of the gifs appearing and not appearing. if i hit Back button to a page...
5
6692
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 but here is the snippet of my asp:hyperlink object; <asp:HyperLink NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(Conta iner.DataItem,"CLIENTREF")%> ID="Hyperlink1"><%#DataBinder.Eval(Container.DataItem,...
10
1946
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 a column of URLs to this hyperlink column in programming way (ie., dynamically assignment). However, I can not find a way to continue doing it. Do you have ideas about it? Thanks.
2
2187
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. When the form is opened, the INI file is read and sets up the column widths for the user. Works well, but there is a slight delay on closing the form, so I would like to detect if any column widths have been changed and save them only if...
20
3011
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 a control. I have 2 files "displayCompanyJobs.aspx" and "displayCompanyOverview.aspx" which are in both the folder "/jobseeker/" and "/employer/". I have a user control "displayCompanyJobs.ascx" that is in my /applicant/
6
9927
Markus
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. <table> <tr> <td width="80%"> ... </td> <td width="20%"> ... </td> </tr>
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10548
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10316
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7604
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.