Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Wrap long URL in table

Reply
Thread Tools

Wrap long URL in table

 
 
Scott Gordo
Guest
Posts: n/a
 
      09-21-2006
I have an .aspx page that's pulling content from a SQL db.
Sometimes users add long urls into a table/cell 400px wide. (Today's
example was
http://newyork.yankees.mlb.com/NASAp...ng_pricing.jsp)
This spreads the layout and messes up the spacing.
I would tell the users to change their habits (insert text "click here"
and assign the url to it) but it ain't gonna happen. I'm looking for a
way to get the URL to wrap within the table.
Any recommendations?
TIA!

Scott

 
Reply With Quote
 
 
 
 
Jim Moe
Guest
Posts: n/a
 
      09-21-2006
Scott Gordo wrote:
> I have an .aspx page that's pulling content from a SQL db.
> Sometimes users add long urls into a table/cell 400px wide. (Today's
> example was
> http://newyork.yankees.mlb.com/NASAp...ng_pricing.jsp)
> This spreads the layout and messes up the spacing.
> I would tell the users to change their habits (insert text "click here"
> and assign the url to it) but it ain't gonna happen. I'm looking for a
> way to get the URL to wrap within the table.
> Any recommendations?
>

Do not use the URL as the displayed text. Pick something more meaningful
and contextually pertinent, like "Yankess Seating Pricing", and put the
URL in the <a> where it belongs.
But since that "ain't gonna happen" (your visitors are highly
inflexible) you are stuck with a deformed layout.
Or you can add arbitrary spaces to the URL every nth character but then
the URL text cannot be copied/pasted.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      09-21-2006
Jim Moe wrote:

> Do not use the URL as the displayed text.


Agreed.

> Or you can add arbitrary spaces to the URL every nth character but
> then the URL text cannot be copied/pasted.


No, that's a wrong approach. If you _really_ must put URLs as text on a web
page, throw in some <wbr> tags after suitable characters, such as "?", "/",
and "&". See
http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
Brian Cryer
Guest
Posts: n/a
 
      09-22-2006
"Jukka K. Korpela" <> wrote in message
news:%FDQg.17342$ ...
> Jim Moe wrote:
>
>> Do not use the URL as the displayed text.

>
> Agreed.
>
>> Or you can add arbitrary spaces to the URL every nth character but
>> then the URL text cannot be copied/pasted.

>
> No, that's a wrong approach. If you _really_ must put URLs as text on a
> web page, throw in some <wbr> tags after suitable characters, such as "?",
> "/", and "&". See
> http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest


The <wbr> tag is great, widely supported but isn't in the w3c spec, so if
you use it then your page won't validate. I know this because I used to make
frequent use <wbr> until I got my fingers burnt over validation.

As an alternative, why not use the word-wrap css, for example:

<p style="width: 5em; word-wrap: break-word">12345678901234567890</p>

should render as two or more lines (depending on your font settings). Of
course to use this you have to know the maximum width you want - but the OP
knew his width.
--
Brian Cryer
www.cryer.co.uk/brian



 
Reply With Quote
 
Scott Gordo
Guest
Posts: n/a
 
      09-22-2006

Brian Cryer wrote:
> "Jukka K. Korpela" <> wrote in message
> news:%FDQg.17342$ ...
> > Jim Moe wrote:
> >
> >> Do not use the URL as the displayed text.

> >
> > Agreed.
> >
> >> Or you can add arbitrary spaces to the URL every nth character but
> >> then the URL text cannot be copied/pasted.

> >
> > No, that's a wrong approach. If you _really_ must put URLs as text on a
> > web page, throw in some <wbr> tags after suitable characters, such as "?",
> > "/", and "&". See
> > http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest

>
> The <wbr> tag is great, widely supported but isn't in the w3c spec, so if
> you use it then your page won't validate. I know this because I used to make
> frequent use <wbr> until I got my fingers burnt over validation.
>
> As an alternative, why not use the word-wrap css, for example:
>
> <p style="width: 5em; word-wrap: break-word">12345678901234567890</p>
>
> should render as two or more lines (depending on your font settings). Of
> course to use this you have to know the maximum width you want - but the OP
> knew his width.
> --
> Brian Cryer
> www.cryer.co.uk/brian


Thanks all. Now, instead of wrapping, I think that what I'm really
looking for is what google did to my original post. After a certain
number of characters, google automatically cut it off and inserted
ellipses.There was maybe another ten characters it lopped off.
I think I need a script that recognizes any code that starts with
">http://" and limits it to a certain number of characters (say 30)
before cutting it off and inserting ellipses, while leaving the "<a
href="http://" alone.
Any ideas or leads?

Scott

 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      09-22-2006
Brian Cryer wrote:
<snip>

> As an alternative, why not use the word-wrap css, for example:
>
> <p style="width: 5em; word-wrap: break-word">12345678901234567890</p>

^^^^^^^^^^^^^^^^^^^^^
word-wrap? You won't find it here

<http://www.w3.org/TR/CSS21/propidx.html>

That is an MS thingy..... If OP really wants to force breaking lines
intra-words of user input he needs to process server-side with some
function that counts characters or looks for specific character to break
on like '/' and insert BRs into the markup <= some maximum character
length within the string....

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Brian Cryer
Guest
Posts: n/a
 
      09-22-2006

"Jonathan N. Little" <> wrote in message
news:8a9ad$4513f4bd$40cba77e$...
> Brian Cryer wrote:
> <snip>
>
>> As an alternative, why not use the word-wrap css, for example:
>>
>> <p style="width: 5em; word-wrap: break-word">12345678901234567890</p>

> ^^^^^^^^^^^^^^^^^^^^^
> word-wrap? You won't find it here
>
> <http://www.w3.org/TR/CSS21/propidx.html>
>
> That is an MS thingy..... If OP really wants to force breaking lines
> intra-words of user input he needs to process server-side with some
> function that counts characters or looks for specific character to break
> on like '/' and insert BRs into the markup <= some maximum character
> length within the string....


The trouble with w3c is that they have too many working draft documents.
Take a look at http://www.w3.org/TR/css3-text/, that's the document from
which I learnt about word-wrap.
--
Brian Cryer
www.cryer.co.uk/brian



 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      09-22-2006
Brian Cryer wrote:
> "Jonathan N. Little" <> wrote in message
> news:8a9ad$4513f4bd$40cba77e$...
>> Brian Cryer wrote:
>> <snip>
>>
>>> As an alternative, why not use the word-wrap css, for example:
>>>
>>> <p style="width: 5em; word-wrap: break-word">12345678901234567890</p>

>> ^^^^^^^^^^^^^^^^^^^^^
>> word-wrap? You won't find it here
>>
>> <http://www.w3.org/TR/CSS21/propidx.html>
>>
>> That is an MS thingy..... If OP really wants to force breaking lines
>> intra-words of user input he needs to process server-side with some
>> function that counts characters or looks for specific character to break
>> on like '/' and insert BRs into the markup <= some maximum character
>> length within the string....

>
> The trouble with w3c is that they have too many working draft documents.
> Take a look at http://www.w3.org/TR/css3-text/, that's the document from
> which I learnt about word-wrap.


Agreed! But stick with CSS 2.1 Recommendation. Working draft are just
that working drafts. You'll have enough trouble with CSS 2.1 and that
pseudo-yet-all-too-popular browser that only spottily supports it!

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Spartanicus
Guest
Posts: n/a
 
      09-22-2006
"Jonathan N. Little" <> wrote:

>But stick with CSS 2.1 Recommendation.


No such thing, the highest status CSS 2.1 achieved was Candidate
Recommendation, but it has since been downgraded again to a Working
Draft due to ridiculous W3C criteria.

In this case that should not be seen as a reason not to use it as it is
the best resource to use for practical CSS authoring, much better than
the CSS 2.0 Rec.

--
Spartanicus
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      09-22-2006
Jonathan N. Little wrote:

> But stick with CSS 2.1 Recommendation.


It says: "This is a draft document and may be updated, replaced or obsoleted
by other documents at any time. It is inappropriate to cite this document as
other than work in progress."

> Working draft are just that working drafts.


Some working drafts are more working drafts than others. The CSS 2.1 draft
is relatively close to what browsers do at best these days, whereas "CSS 3"
is just a collection of sketches, ideas, and partly finalized drafts.

Followups trimmed.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
 
 
Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to wrap a long string Li Chen Ruby 5 09-25-2008 10:43 PM
how to wrap a long text through css. Victor ASP .Net 6 06-05-2007 06:52 PM
Long text in a table does not wrap? Simon HTML 26 03-24-2006 05:51 PM
Wrap long text in dropdown list box Pauravi ASP .Net Web Controls 0 09-26-2005 02:16 PM
wrap a really long line Ken Sington Perl Misc 3 06-14-2004 02:09 PM



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