SunQuest
           CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 10th, 2003, 09:04 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 545 DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 36 m 46 sec
Reputation Power: 14
CSS fill remaining width of a screen

Well, I'm finding that using <DIV> with CSS for layout purposes is far more complex then using <TABLE>

How do I make an element, such as <SPAN>, fill the remaining width of a screen using CSS?

For example, let's say I have an images and a single line of text enclosed by <DIV>, I want to place a <SPAN> on the right of the the text (also within the DIV) and have it stretch to the right side of the screen.

Is this possible? It would be simple using tables.
__________________
Ooh, they have the Internet on computers now!

Reply With Quote
  #2  
Old June 10th, 2003, 10:02 PM
Phil_work Phil_work is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Canberra, Australia
Posts: 317 Phil_work User rank is Corporal (100 - 500 Reputation Level)Phil_work User rank is Corporal (100 - 500 Reputation Level)Phil_work User rank is Corporal (100 - 500 Reputation Level)Phil_work User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 19 h 42 m 18 sec
Reputation Power: 7
you could use

width: 100%;
text-align: left;

That may work. I haven't tested it, should work with IE but the rest ???

Reply With Quote
  #3  
Old June 10th, 2003, 10:42 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 545 DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 36 m 46 sec
Reputation Power: 14
Unfortunately the width attribute is calculated on the width of your screen. So if your browser window is 800 pixels wide then "width" will return 800. If you put this element beside something like I want to it will either wrap to the next line or increase the width of your page beyond the width of the window.

Reply With Quote
  #4  
Old June 11th, 2003, 06:16 AM
icy_polecat's Avatar
icy_polecat icy_polecat is offline
Senior Polecat
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Jersey (the original version)
Posts: 210 icy_polecat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 57 sec
Reputation Power: 6
Send a message via Yahoo to icy_polecat
i had the very same problem.

my solution was to create the spav at 100% width - 0px from the top and the left and then use the margin attribute (or it might have been clipping) to force the text over to the right. Then i put my lefthand vertical div over the top of the main span.

It's a lame way of doing it but it worked for me.

Of course what you really want is some kind of alternative size system similar to * in framesets but i don't see this being implemented until the next release of CSS

Icy
__________________
Quidquid latine dictum sit, altum viditur.

http://www.XSet.co.uk

Reply With Quote
  #5  
Old June 11th, 2003, 06:48 AM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,622 Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 2 h 18 m 25 sec
Reputation Power: 548
remember you can't normaly set width to a span. its for inline style-
though browsers like ie let you set width to it, others like mozilla will not,

you could use display:block in the span and then set a width.
but then again you could just as well have used a div tag.

Reply With Quote
  #6  
Old June 11th, 2003, 05:36 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 545 DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 36 m 46 sec
Reputation Power: 14
The problem with setting the width is that I don't know how wide the screen is and the content on the left may change width from browser to browser.

icy_polecat looks to have the best option.

It's surprising that something this trivial wasn't implemented into the current version of CSS.

Reply With Quote
  #7  
Old June 11th, 2003, 06:36 PM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,622 Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 2 h 18 m 25 sec
Reputation Power: 548
i'm not completely
getting your problem
so if you phrase it a bit better, i might be albe to help,

why do you want the span to fill the whole width? just to have another background color, or?

Reply With Quote
  #8  
Old June 11th, 2003, 07:00 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 545 DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 36 m 46 sec
Reputation Power: 14
I've attached a picture which shows how I'm using it.

You will see that between the pale green and the dark green area's there is a black line (border-bottom). But the line stops after the "PELM Enquiries" link. I need it to continue to all the way across.

The pale green area is dfined by a DIV which enloses a series of SPAN tags and the links that have Border-Bottom set. The dark green is defined by another DIV. I've done it this way as I don't want a border below the link for the current page, in this case "About PELM".

I was hoping I could simply put in a SPAN after PELM Enquiries to fill this gap with a black line.

Perhaps there is an easier way to do this?

Reply With Quote
  #9  
Old June 11th, 2003, 07:26 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 545 DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level)DrWorm User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 36 m 46 sec
Reputation Power: 14
My attachment doesn't appear to have attached. I'll try again.
Attached Images
File Type: gif nav-bar.gif (1.4 KB, 1215 views)

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS fill remaining width of a screen


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway