Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Code Requests
  • Completed Requests
  • [Completed] [ZB] Justified Allignment
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
[Completed] [ZB] Justified Allignment
Tweet Topic Started: Nov 15 2009, 06:13 AM (261 Views)
Alexis Shadow Nov 15 2009, 06:13 AM Post #1


Posts:
34
Group:
Member
Member
#1,642
Joined:
Nov 28, 2008
I have very little faith that this is even possible, but then, I know nothing of Javascript, so I figured I'd try my luck.

I was wondering if it was possible for a code to replicate the Justified alignment type that's available in almost every modern word processor. You know, the thing that expands the width of spaces between words so that the right hand side of the text is in line as well as the left side. If you don't know what I mean, open MS Word and click the button just to the right of the 'Right Alignment' button.

Please and thanks?
Offline Profile Goto Top
 
Gorgor Nov 15 2009, 07:18 AM Post #2
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Yep, you can simple add to your CSS
Code:
 
text-align: justified;
under the element that you want to change to that. If you're unsure on how to do this, then simply state what on the page you wish to make justified and I'll help you with that :)
Offline Profile Goto Top
 
Alexis Shadow Nov 16 2009, 12:21 AM Post #3


Posts:
34
Group:
Member
Member
#1,642
Joined:
Nov 28, 2008
Ahh... I actually wanted to be able to apply it as formatting when posting/replying. Sorry I wasn't clear :P
Offline Profile Goto Top
 
Gorgor Nov 16 2009, 03:12 PM Post #4
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Sorry if I don't understand you correct, but do you mean like a [justified] BBCode that users can use to justify their text in a post?
Offline Profile Goto Top
 
Alexis Shadow Nov 18 2009, 12:14 AM Post #5


Posts:
34
Group:
Member
Member
#1,642
Joined:
Nov 28, 2008
Yep, that's exactly what I mean.
Offline Profile Goto Top
 
Gorgor Nov 18 2009, 03:14 PM Post #6
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Enter this in your board template:
Code:
 
<script type='text/javascript'>
$(function(){
$(".c_post:contains([justified])").each(function(){
this.innerHTML = this.innerHTML.replace(/\[justified\](.*)\[\/justified\]/gi,"<span class='justified'>$1</span>")
})
})
</script>

And in your CSS, enter:
Code:
 
.justified {
text-align: justified;
}
Offline Profile Goto Top
 
Alexis Shadow Nov 19 2009, 02:12 PM Post #7


Posts:
34
Group:
Member
Member
#1,642
Joined:
Nov 28, 2008
I couldn't get it to work. Where exactly should I put each of those?
Offline Profile Goto Top
 
Gorgor Nov 19 2009, 03:25 PM Post #8
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Sorry, I mispelled something. Enter this in your CSS instead of the previous one I told you.
Code:
 
.justified {
text-align: justify;
}
Offline Profile Goto Top
 
Choco Nov 25 2009, 06:53 PM Post #9
Member Avatar
¡ʎɹoʇɔɐɟ ʎʇıʌɐɹƃ ɐ uı pǝddɐɹʇ ɯ,ı 'dןǝɥ

Posts:
589
Group:
Admins
Member
#3,272
Joined:
Jun 30, 2009
Coding language
Everything
You're welcome.
See? We can read thoughts too. ;)

Your request has been completed, and we're moving it to the correct forum. We hope it works for you; if it doesn't, feel free to post another request topic in the requests forum. Just remember: read the rules first!

Thanks,
The ZBCode Staff
Posted ImageIt's a magical world, Hobbes, ol'd buddy... ...let's go exploring!
In progress: Something Special ;)
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Completed Requests · Next Topic »
Locked Topic

Track Topic · E-mail Topic Time: 2:26 PM Jul 11
Hosted for free by ZetaBoards · Privacy Policy