473,324 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

"Justify"-like effect within text

We all know that text-align: justify; is supposed to justify the
block's text across the box. I have a friend, however, who wants to
take that further. A visual example, because it's 2:30 AM and I don't
want to try to describe it:

MARGIN| S O M E T E X T |MARGIN

Where "SOME TEXT" is a heading, presumably, and the spacing between
letters works out such that the contents space to fit the whole box,
which stretches and shrinks with the browser or page.

Ideally we'd like to avoid putting each letter in a div, but if that's
the only way...

Owen
Jul 20 '05 #1
6 4343
Owen Jacobson wrote on 02 sep 2003 in
comp.infosystems.www.authoring.stylesheets:
We all know that text-align: justify; is supposed to justify the
block's text across the box. I have a friend, however, who wants to
take that further. A visual example, because it's 2:30 AM and I don't
want to try to describe it:

MARGIN| S O M E T E X T |MARGIN

Where "SOME TEXT" is a heading, presumably, and the spacing between
letters works out such that the contents space to fit the whole box,
which stretches and shrinks with the browser or page.

Ideally we'd like to avoid putting each letter in a div, but if that's
the only way...


<style>
span{width:400px;border:green solid 1px;
letter-spacing:33px;text-align:center;}
</style>

This is
<span>SOME TEXT</span>
justified in IE6

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
"Owen Jacobson" <oj**************@mx-deus.net> wrote:
We all know that text-align: justify; is supposed to justify the
block's text across the box.
And justification generally makes things worse, see
http://www.cs.tut.fi/~jkorpela/www/justify.html
I have a friend, however, who wants to
take that further. - -
MARGIN| S O M E T E X T |MARGIN


I don't think there's a way to do that in "standard" CSS, but if your
friend is happy with something that works on IE 6, you could use

<div class="special">Some text</div>

with

..special { text-align: justify;
text-justify: distribute;
text-align-last: justify;
text-transform: uppercase;
margin: 0 3em; }

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #3
Owen Jacobson wrote on 02 sep 2003 in
comp.infosystems.www.authoring.stylesheets:
Evertjan. wrote:
<style>
span{width:400px;border:green solid 1px;

^^^^^^^^^^^^

No good. The box in question has to change size with the page.
Letter-spacing seems to behave a little weirdly with percentage lengths
in that each letter is frequently (non-monospaced) font not the same
width on its own.


I think it is very good, not perfect, but without scripting, css will not
help you to all your specs.

Perhaps change the specs ?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #4
Jukka K. Korpela wrote on 02 sep 2003 in
comp.infosystems.www.authoring.stylesheets:
I don't think there's a way to do that in "standard" CSS, but if your
friend is happy with something that works on IE 6, you could use

<div class="special">Some text</div>

with

.special { text-align: justify;
text-justify: distribute;
text-align-last: justify;
text-transform: uppercase;
margin: 0 3em; }


Well done!

some detail:

<style>
..special { text-align:justify;
text-justify:newspaper;
text-align-last:justify;
padding:0 5%;
margin:0 20%;
border:green solid 1px;}
</style>

<div class="special">Some text</div>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #5
Jukka K. Korpela wrote:
"Owen Jacobson" <oj**************@mx-deus.net> wrote:
We all know that text-align: justify; is supposed to justify the
block's text across the box.
And justification generally makes things worse, see
http://www.cs.tut.fi/~jkorpela/www/justify.html


Yah. I don't believe he's justifying the bulk of his content, only
attempting to get the described effect on a heading.
I don't think there's a way to do that in "standard" CSS, but if your
friend is happy with something that works on IE 6, you could use
Unfortunately not. He's a Mac person, to start with, and he's not a
fan of platform-specific solutions. Smart man.
<div class="special">Some text</div>

with

.special {
...
text-justify: distribute;
...
}


Is there any movement afoot to add something similar to CSS 3, as far
away as that may actually be? It seems like a useful feature.

Owen
Jul 20 '05 #6
Owen Jacobson wrote:
Jukka K. Korpela wrote:
<div class="special">Some text</div>

with

.special {
...
text-justify: distribute;
...
}


Is there any movement afoot to add something similar to CSS 3, as far
away as that may actually be? It seems like a useful feature.


4.2. Justification: the 'text-justify' property
<http://www.w3.org/TR/css3-text/#justification-prop>

--
Steve

Authority without wisdom is like a heavy axe without an edge, fitter to
bruise than polish. -Anne Bradstreet
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
">"
by: Tim Tyler | last post by:
Should PHP have allowed ">" to be used within PHP tags? e.g. in: if (a > b) { ... }; ....and... $object -> member;
4
by: OJ | last post by:
Hey, I'm trying to make a right justified, bullet on the right, list. The only way that I've found is to use the "direction" attribute: <style> ul.rtl { direction: rtl; } </style> <ul...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
7
by: William Payne | last post by:
Hello, have you seen a recent files menu in a GUI application? In many GUI applications there's a menu the displays the most recent files that has been opened by the program. Say such a menu has...
8
by: cainlevy | last post by:
I'm wondering if there's any way to speed up create table queries? Besides upgrading hardware, that is. The very simplest table creation query, "create table table1 ( field1 INT(10))" is taking...
16
by: rik | last post by:
I was flicking through a PHP book (one of the teach in 24 hour ones) and I came across something I had never seen before in PHP. It was a method of printing out without using the print method, it...
86
by: Randy Yates | last post by:
In Harbison and Steele's text (fourth edition, p.111) it is stated, The C language does not specify the range of integers that the integral types will represent, except ot say that type int may...
6
by: kobu.selva | last post by:
I was recently part of a little debate on the issue of whether constants and string literals are considered "data objects" in C. I'm more confused now than before. I was always under the...
61
by: academic | last post by:
When I declare a reference variable I initialize it to Nothing. Now I'm wondering if that best for String variables - is "" better? With Nothing I assume no memory is set aside nor GC'ed But...
6
by: karen987 | last post by:
I have a webpage called "topicview.asp" on a news website with ASP pages, it's a simple news publishing software. You add the news from the Admin section and all the details are stored in a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.