Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > CSS: Value for display to avaid line breaking ?

Reply
Thread Tools

CSS: Value for display to avaid line breaking ?

 
 
Matthias Pospiech
Guest
Posts: n/a
 
      02-20-2005
I define a class url
..url
{
display: ??;
color: #606060;
}

which is used as

<li>
<a href="http://www.tug.org/interest.html">TeX Resources on the Web</a>
<span class="url">http://www.tug.org/interest.html</span></li>

now I want the span to be a block, ie. to break in to the next line if the
url does not fit into the current one.

What kind of value for display is the correct on in that case ?
I tried "block", but that puts it always in the next line.

Matthias
 
Reply With Quote
 
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      02-20-2005
Matthias Pospiech wrote:

> now I want the span to be a block, ie. to break in to the next line if the
> url does not fit into the current one.


You are misunderstanding what a block is.

You probably want:

white-space: nowrap;

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
 
 
 
Matthias Pospiech
Guest
Posts: n/a
 
      02-20-2005
Toby Inkster wrote:

> Matthias Pospiech wrote:
>
>> now I want the span to be a block, ie. to break in to the next line if
>> the url does not fit into the current one.

>
> You are misunderstanding what a block is.

Maybe - any information ?

> You probably want:
>
> white-space: nowrap;

It work, though an URL has no white space...

Matthias


 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      02-20-2005
Matthias Pospiech <> wrote:

> I define a class url
> .url
> {
> display: ??;
> color: #606060;
> }


You should always specify background whenever you specify color.
What if the user's style sheet contains
* { background: #606060; color: black; }
?

> <li>
> <a href="http://www.tug.org/interest.html">TeX Resources on the
> Web</a> <span
> class="url">http://www.tug.org/interest.html</span></li>
>
> now I want the span to be a block, ie. to break in to the next line if
> the url does not fit into the current one.


That's not what "block" means. A block unconditionally begins on a new line
(unless you do something else explicitly).

> What kind of value for display is the correct on in that case ?


The value inline, which is the default value, so it need not be specified.

Toby's suggestion of using white-space: nowrap might be what you are after.
Contrary to its name - CSS property names are often misleading - it
prevents line breaks inside the content, except for explicitly created
breaks (e.g., <br>). Thus it may prevent a browser from splitting after "/"
for example. Whether this is a good thing to do is a different issue.

Normally URLs should appear as attribute values, not in document content
proper. Have you ever listened to a speech browser reading URLs? It doesn't
actually improve the experience. It's sufficient to have the link there.

If you wish to include a URL for _printed_ copies, then again this might
not be a good idea. The URL of the page itself is usually sufficient and
can be included into the printed copy by the user if desired, and many
browsers can automatically generate a list of URLs appearing in links.

But if you do include a URL into document content proper, I would recommend
using quotation marks or the characters "<" and ">" as delimiters and
encourage (rather than discourage) browsers into splitting a URL across
lines, as described in more detail at
http://www.cs.tut.fi/~jkorpela/html/nobr.html#url

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      02-20-2005
Matthias Pospiech wrote:
> Toby Inkster wrote:
>
>> You are misunderstanding what a block is.

>
> Maybe - any information ?


A block is a chunk of text that starts on a new line and ends with a line
break.

Examples of blocks are:

- a paragraph
- a list item (like this)
- a heading

So a block begins and ends with a line break, but that's not to say that
it can't have line breaks in between. A reasonably long paragraph, such as
this one, will extend onto several lines, but is considered as a block.

>> You probably want:
>> white-space: nowrap;

>
> It work, though an URL has no white space...


As Jukka said, CSS properties are often oddly named.

Consider there is a "background-color" but no "foreground-color". To make
things bold you use "FONT-weight", but to underline them you use
"TEXT-decoration".

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free line breaking Klaus Cammin HTML 53 07-16-2006 12:56 PM
Looking for a breaking news rss feed that really contains breaking news Amy XML 0 02-22-2005 06:31 PM
Graphic Display Breaking Up EgaBeeva Computer Support 1 01-22-2005 05:05 PM
<a title=""> tag and line breaking \(. \)\( .\) siorbaj cycka HTML 6 11-07-2004 10:28 PM
How to print datagrid content without breaking the last line Peter Afonin ASP .Net 4 07-10-2003 02:28 AM



Advertisments