Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Can you force a text span's width?
Old 02-22-2007, 05:24 AM Can you force a text span's width?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
It seems like you should be able to, but I'm having trouble doing it. I've been trying to decide whether to keep the info I have under each photo in tables, which was convenient, or to do it with CSS instead. It's not really tabular data, though, at least not in the relational database sense, so it kind of seems like CSS would be more appropriate.

The nice thing about a table is fixed column widths, but that seemed like it should be pretty easy to mimic, and with a lot less ( and cleaner ) markup. This is my attempt:

Code:
<span class="photoInfoLabel">Location:</span>
Pike's Place, Downtown Seattle, Washington<br />
<span class="photoInfoLabel">Date:</span>
January 4, 2007<br />
With this rule:

Code:
.photoInfoLabel {
    margin-left:15px;
    width:125px;
    font-weight:bold;
}
Unfortunately, the spans are exactly as wide as they need to be to house the text, regardless of the browser. I tried display:inline-block, but that didn't do the trick. I guess I could use divs instead of spans, and float everything to the left, but that seems like overkill? I don't think this is a situation where a table would be more appropriate?

By way of example, this Bryanna is table based and Star Trails is CSS, but apparently bad CSS.

Thanks for any light you can shed on this!
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
 
Register now for full access!
Old 02-22-2007, 10:16 AM Re: Can you force a text span's width?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Tough call, dude.

If it were me personally, I might modify something like this: http://web-graphics.com/mtarchive/001622.php
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 02-22-2007, 03:23 PM Re: Can you force a text span's width?
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Well mate, it looks like you got it working, but it also looks like you gave up and used divs. I think that's the proper way to go, spans are supposed to size themselves as small as possible to only contain whatever text is inside of them.

Page looks great, by the way.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-22-2007, 03:38 PM Re: Can you force a text span's width?
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
PS - That little trick you're doing, the see-through background behind the text, it looks like $h!t using your mortal enemy, Internet Explorer 6. Try this code below, in your CSS:

filter:alpha(opacity=20);
background-color:Black;

Only I think you were using some flavor of gray. Just change the background color according to your taste, and the opacity, too. But this is working code to show you how to actually do that.

Well, maybe "working code" is a bit of a stretch. It's a proprietary IE hack. And it's also an ActiveX control, so it won't work on servers. But it's built into IE, so your visitors won't have to download anything else to view your site.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-28-2007, 11:01 PM Re: Can you force a text span's width?
taketherisk's Avatar
Skilled Talker

Posts: 89
Name: Brett
Location: New Zealand
Trades: 0
Have you tried adding this CSS:

display: block;

Hope that helps... but it seems you went and used divs.

-Brett
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
taketherisk is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Can you force a text span's width?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15308 seconds with 12 queries