Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #11 (permalink)  
Old June 17th, 2012, 09:20 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Justify problem (2)

Sorry I got a typing error in the code and didn't end it correctly.

Code:
<head>
<style type="text/css">
p {margin:0;padding:0;}
</style>
</head>
<body>
<p>BOSBURY Horse Show and</p>
<p>Races - The proverbial fine</p>
<p>day again favoured the hold-</p>
<p>ing of this long-established</p>
</body>
Reply With Quote
  #12 (permalink)  
Old June 17th, 2012, 09:30 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Justify problem (3)

Of course the text-align property is set as well.

Code:
<head>
<style type="text/css">
p {text-align:justify;margin:0;padding:0;}
</style>
</head>
<body>
<p>BOSBURY Horse Show and</p>
<p>Races - The proverbial fine</p>
<p>day again favoured the hold-</p>
<p>ing of this long-established</p>
</body>
Reply With Quote
  #13 (permalink)  
Old June 17th, 2012, 10:27 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,948
Thanks: 79
Thanked 1,555 Times in 1,532 Posts
Default

I think this is by design; I think text-align is just applied to implicit linebreaks (by wrapped text) and not by line breaks or pagragraph ends. Otherwise you end up with wide spaces on the last sentence.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #14 (permalink)  
Old June 17th, 2012, 11:33 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Justify problem (4)

I have found a website that seems to have solved it but I cannot locate the key bit of coding that does the job.

http://www.williamkolean.com/williamblog/?p=23

I shall have to live with it. This is how my newspaper extract looks. It would have been good to have it justified as in the original but there you go.

http://www.bosburyhistoryresource.or...ewspapers.html
Reply With Quote
  #15 (permalink)  
Old June 17th, 2012, 11:37 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,948
Thanks: 79
Thanked 1,555 Times in 1,532 Posts
Default

The text in your article is not aligned in any of the browsers I tested it on so I wonder why you would go down the road of separating each line in its own p element. Wouldn't it justify nicely with a single paragraph except for the last line of text?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #16 (permalink)  
Old June 17th, 2012, 01:11 PM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Justify problem (5)

I have changed it to one long paragraph and uploaded the page as Newspapers2.html

The problem is that, however I adjust text margins, I cannot get the text to divide at the proper words. For example down to the line 8 beginning '20 miles' is fine in Firefox (not IE or Chrome) but 'remark-' should be at the end of line 10 and 'able' at the start of line 11. The only way I can see to have the correct words on the correct line so that it matches the original newspaper article is to break lines using <br> or <p> but then I lose the justification. Aargh!

I hope to transcribe a number of newspaper clippings, hence my search for a display method. I'll keep searching the web for an example with understandable coding.
Reply With Quote
  #17 (permalink)  
Old January 11th, 2015, 10:09 PM
Registered User
 
Join Date: Jan 2015
Location: Memphis, TN
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default break in text-align=justify

I frequently have equations like "5/50 = 10%" and html can spit up the equation. The original complaint that
Code:
<br>5/50 = 10%
doesn't work because the <br> effectively changes text-align=justify to text-align=left for the line the <br> is on.

In this case, it is better technique to use
Code:
5/50&nbsp;=&nbsp;10%
to prevent html from splitting up the equation. In general, this is a better technique anyway for non fixed width web pages.

However, there are other characters that I do not now how to use that technique with. Any help for me?
Reply With Quote
Reply


Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace "<enter>" with "<br>" Varg_88 Classic ASP Basics 5 February 14th, 2011 11:33 AM
<br/> becomes <br></br> Kabe XSLT 1 July 6th, 2007 07:42 AM
to append <br> in XSLT dharus XSLT 4 August 1st, 2006 09:52 AM
Replacing Garriage Returns with <br /> rit01 ASP.NET 2.0 Basics 7 March 21st, 2006 02:33 AM
Replace vbcrlf with <br> using C# kgriffin ASP.NET 1.0 and 1.1 Basics 2 May 4th, 2005 09:29 AM



All times are GMT -4. The time now is 07:22 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.