![]() |
|
|
|
#1 |
|
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 Scott Gordo |
|
|
|
|
#2 |
|
Posts: n/a
|
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) |
|
|
|
#3 |
|
Posts: n/a
|
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/ |
|
|
|
#4 |
|
Posts: n/a
|
"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 |
|
|
|
#5 |
|
Posts: n/a
|
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 |
|
|
|
#6 |
|
Posts: n/a
|
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 |
|
|
|
#7 |
|
Posts: n/a
|
"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 |
|
|
|
#8 |
|
Posts: n/a
|
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 |
|
|
|
#9 |
|
Posts: n/a
|
"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 |
|
|
|
#10 |
|
Posts: n/a
|
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/ |
|