{"id":618,"date":"2023-03-03T03:38:06","date_gmt":"2023-03-03T03:38:06","guid":{"rendered":"https:\/\/www.toolkit.keywordfinder.us\/?page_id=618"},"modified":"2023-03-03T03:38:06","modified_gmt":"2023-03-03T03:38:06","slug":"justify-text","status":"publish","type":"page","link":"https:\/\/tools.billionsideas.com\/de\/justify-text\/","title":{"rendered":"Justify Text"},"content":{"rendered":"<meta charset=\"utf-8\">\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t<link rel=\"stylesheet\" type=\"text\/css\" href=\"style.css\">\n\t<script src=\"https:\/\/code.jquery.com\/jquery-3.6.0.min.js\"><\/script>\n\t<script src=\"script.js\"><\/script>\n<section>\n\n\t<h1>Justify Text Tool<\/h1>\n\n\t<div class=\"container\">\n\t\t<div class=\"row\">\n\t\t\t<label for=\"font-select\">Font:<\/label>\n\t\t\t<select id=\"font-select\">\n\t\t\t\t<option value=\"Arial\">Arial<\/option>\n\t\t\t\t<option value=\"Helvetica\">Helvetica<\/option>\n\t\t\t\t<option value=\"Times New Roman\">Times New Roman<\/option>\n\t\t\t\t<option value=\"Georgia\">Georgia<\/option>\n\t\t\t\t<option value=\"Verdana\">Verdana<\/option>\n\t\t\t<\/select>\n\t\t<\/div>\n\t\t<div class=\"row\">\n\t\t\t<label for=\"font-size-select\">Font Size:<\/label>\n\t\t\t<select id=\"font-size-select\">\n\t\t\t\t<option value=\"12px\">12<\/option>\n\t\t\t\t<option value=\"14px\">14<\/option>\n\t\t\t\t<option value=\"16px\">16<\/option>\n\t\t\t\t<option value=\"18px\">18<\/option>\n\t\t\t\t<option value=\"20px\">20<\/option>\n\t\t\t<\/select>\n\t\t<\/div>\n\t\t<div class=\"row\">\n\t\t\t<label for=\"line-height-select\">Line Height:<\/label>\n\t\t\t<select id=\"line-height-select\">\n\t\t\t\t<option value=\"1.0\">Single<\/option>\n\t\t\t\t<option value=\"1.5\">1.5<\/option>\n\t\t\t\t<option value=\"2.0\">Double<\/option>\n\t\t\t<\/select>\n\t\t<\/div>\n\t\t<div class=\"row\">\n\t\t\t<label for=\"file-input\">Upload File:<\/label>\n\t\t\t<input type=\"file\" id=\"file-input\">\n\t\t<\/div>\n\t\t<div class=\"row\">\n\t\t\t<button id=\"justify-button\">Justify Text<\/button>\n\t\t\t<button id=\"copy-button\">Copy Text<\/button>\n\t\t<\/div>\n\t<\/div>\n\n\t<div class=\"container\">\n\t\t<textarea id=\"input-text\" placeholder=\"Enter text here...\"><\/textarea>\n\t\t<div id=\"output-text\"><\/div>\n\t<\/div>\n\n\n\n<\/section>\n\n\n\n\n\n<script>\n$(document).ready(function() {\n\t\/\/ Get references to DOM elements\n\tvar $inputText = $('#input-text');\n\tvar $outputText = $('#output-text');\n\tvar $fontSelect = $('#font-select');\n\tvar $fontSizeSelect = $('#font-size-select');\n\tvar $lineHeightSelect = $('#line-height-select');\n\tvar $fileInput = $('#file-input');\n\tvar $justifyButton = $('#justify-button');\n\tvar $copyButton = $('#copy-button');\n\n\t\/\/ Justify the text\n\tfunction justifyText() {\n\t\t\/\/ Get the input text\n\t\tvar inputText = $inputText.val();\n\n\t\t\/\/ Remove line breaks and extra spaces\n\t\tinputText = inputText.replace(\/\\n\/g, ' ').replace(\/\\s+\/g, ' ').trim();\n\n\t\t\/\/ Split the text into words\n\t\tvar words = inputText.split(' ');\n\n\t\t\/\/ Get the selected font, font size, and line height\n\t\tvar font = $fontSelect.val();\n\t\tvar fontSize = $fontSizeSelect.val();\n\t\tvar lineHeight = $lineHeightSelect.val();\n\n\t\t\/\/ Calculate the maximum number of words per line\n\t\tvar wordsPerLine = Math.floor(($outputText.width() - 20) \/ (fontSize.slice(0, -2) * 0.6));\n\n\t\t\/\/ Create an array of lines\n\t\tvar lines = [];\n\t\tvar line = '';\n\t\tfor (var i = 0; i < words.length; i++) {\n\t\t\tif (line.length + words[i].length + 1 <= wordsPerLine) {\n\t\t\t\tline += words[i] + ' ';\n\t\t\t} else {\n\t\t\t\tlines.push(line.trim());\n\t\t\t\tline = words[i] + ' ';\n\t\t\t}\n\t\t}\n\t\tlines.push(line.trim());\n\n\t\t\/\/ Create the HTML for the output text\n\t\tvar outputHTML = '';\n\t\tfor (var i = 0; i < lines.length; i++) {\n\t\t\tvar style = 'font-family: ' + font + '; font-size: ' + fontSize + '; line-height: ' + lineHeight + ';';\n\t\t\tif (i == lines.length - 1) {\n\t\t\t\tstyle += ' text-align: justify;';\n\t\t\t}\n\t\t\toutputHTML += '<div style=\"' + style + '\">' + lines[i] + '<\/div>';\n\t\t}\n\n\t\t\/\/ Display the output text\n\t\t$outputText.html(outputHTML);\n\t}\n\n\t\/\/ Handle file upload\n\t$fileInput.change(function() {\n\t\tvar file = this.files[0];\n\t\tvar reader = new FileReader();\n\t\treader.onload = function() {\n\t\t\t$inputText.val(reader.result);\n\t\t}\n\t\treader.readAsText(file);\n\t});\n\n\t\/\/ Justify the text when the button is clicked\n\t$justifyButton.click(function() {\n\t\tjustifyText();\n\t});\n\n\t\/\/ Copy the output text when the button is clicked\n\t$copyButton.click(function() {\n\t\tvar range = document.createRange();\n\t\trange.selectNodeContents($outputText.get(0));\n\t\tvar selection = window.getSelection();\n\t\tselection.removeAllRanges();\n\t\tselection.addRange(range);\n\t\tdocument.execCommand('copy');\n\t});\n\n\t\/\/ Justify the text on load\n\tjustifyText();\n});\n\n<\/script>\n<style>\n\nbody{text-align:center}\n\n\/* Button Styles *\/\nbutton, .button, #button, btn, .btn, #btn, downloadlink,  #download-button, #button-copy, button-copy, copy-button, #copy-button, #copy, copy, #download-html-button{\n  display: inline-block;\n  padding: 12px 24px;\n  font-size: 16px;\n  font-weight: 500;\n  color: #ffffff;\n  text-transform: uppercase;\n  text-decoration: none;\n  text-align: center;\n  border-radius: 30px;\n  background-image: linear-gradient(to right, #0088FF, #0088FF);\n  border: 3px solid #fff;\n  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);\n  transition: all 0.3s ease;\n  margin:0 auto;\n  margin-top:11px;\n  margin-bottom:11px;\n  text-shadow: 2px 2px 4px #333;\n}\n\n\/* Button Hover State *\/\nbutton:hover {\n  background-image: linear-gradient(to right, #FF1493, #FF1493);\n  border: 3px solid #ffffff;\n  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);\n}\n\n -input{\n  width: 25%;\n  height: 100%;\n  padding: 5px;\n  font-size: 16px;\n  font-family: Arial, sans-serif;\n  border: 2px solid;\n  border-image: linear-gradient(to right, #06c, #f90) 1;\n  border-radius: 5px;\n  box-shadow: 2px 2px 5px #ccc;\n  transition: all 0.2s ease-in-out;\n  margin-top:10px;margin-bottom:10px;\n  margin:0 auto;\n}\n\ninput[type=file]::file-selector-button {\n  display: inline-block;\n  padding: 1.0rem 1rem;\n  font-size: 1.125rem;\n  font-weight: bold;\n  color: #fff;\n  text-align: center;\n  text-transform: uppercase;\n  background-color: #0088FF;\n  border-radius: 0rem;\n  cursor: pointer;\n  transition: background-color 0.2s ease-in-out;\n  border: 0px solid #fff;\n  width:100%;\n  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);\n}\n\ninput[type=file]::file-selector-button:hover {\n  background-color: #5b52d6;\n}\n\ninput[type=file]::file-selector-button:active {\n  background-color: #4a41ad;\n}\n\ninput[type=file]::file-selector-button:focus {\n  outline: none;\n  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #6c63ff;\n}\n\ninput[type=file]::file-selector-button::before {\n  content: \"Select File\";\n}\n\ninput[type=file]::file-selector-button::before,\ninput[type=file]::file-selector-button::before {\n  content: \"\\2193 Browse Files\";\n}\n\n\ninput[type=\"file\"] {\n  display: yes;\n}\ninput[type=\"text\"], input[type=\"url\"] {\n  width: 80%;\n  height: 50px;\n  padding: 5px;\n  font-size: 16px;\n  font-family: Arial, sans-serif;\n  border: 2px solid;\n  border-image: linear-gradient(to right, #06c, #f90) 1;\n  border-radius: 5px;\n  box-shadow: 2px 2px 5px #ccc;\n  transition: all 0.2s ease-in-out;\n  margin-top:10px;margin-bottom:10px;\n  margin:0 auto;\n}\ninput[type=\"number\"], select {\n  width: 30%;\n  height: 50px;\n  padding: 5px;\n  font-size: 16px;\n  font-family: Arial, sans-serif;\n  border: 2px solid;\n  border-image: linear-gradient(to right, #06c, #f90) 1;\n  border-radius: 5px;\n  box-shadow: 2px 2px 5px #ccc;\n  transition: all 0.2s ease-in-out;\n  margin-top:10px;margin-bottom:10px;\n  margin:0 auto;\n}\n\ntextarea {\n  width: 100%;\n  height: 170px;\n  padding: 10px;\n  font-size: 16px;\n  font-family: Arial, sans-serif;\n  border: 2px solid;\n  border-image: linear-gradient(to right, #06c, #f90) 1;\n  border-radius: 5px;\n  box-shadow: 2px 2px 5px #ccc, -2px -2px 5px #ccc;  \n  transition: all 0.2s ease-in-out;\n  margin-top:10px;margin-bottom:10px;\n  margin:0 auto;\n}\n\ntextarea:hover {\n  border-color: #06c;\n  box-shadow: 2px 2px 10px #06c;\n}\n\ntextarea:focus {\n  outline: none;\n  border-color: #06c;\n  box-shadow: 2px 2px 10px #06c;\n}\n\ncanvas, #image-container, .img, #img, image, .image, #image, #convertedImage, #preview-image {\n  border: 5px solid;\n  border-image: linear-gradient(to bottom, #007bff, #00f260);\n  border-image-slice: 1;\n  box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.3);\n  margin-top:10px;margin-bottom:10px;\n  width:90%;\n  margin:0 auto;padding:15px;\n\n}\n\n#image-container img {\n  max-width: 100%;\n  }\n\ncode, pre, .result, output, #output, .output {\n  font-family: Monaco, Consolas, \"Andale Mono\", \"DejaVu Sans Mono\", monospace;\n  font-size: 0.9em;\n  color: #333;\n  background-color: #f9f9f9;\n  padding: 0.2em 0.4em;\n  border: 2px solid;\n  border-image: linear-gradient(to right, #06c, #f90) 1;\n  border-radius: 5px;\n  box-shadow: 2px 2px 5px #ccc, -2px -2px 5px #ccc;  \n  transition: all 0.2s ease-in-out;\n  white-space: pre-wrap;\n  margin-top:10px;margin-bottom:10px;\n  margin:0 auto;\n  width:100%;\n  padding:15px;\n\n}\n\n\ninput[type=\"range\"] {\n  -webkit-appearance: none;\n  width: 80%;\n  background: transparent;\n  height: 10px;\n  border-radius: 5px;\n  outline: none;\n  padding: 0;\n  margin: 0;\n  box-shadow: inset 0 0 5px #333;\n  transition: box-shadow 0.2s;\n  margin-top:10px;\n\n}\n\ninput[type=\"range\"]:focus {\n  box-shadow: inset 0 0 5px #888;\n}\n\ninput[type=\"range\"]::-webkit-slider-thumb {\n  -webkit-appearance: none;\n  height: 20px;\n  width: 20px;\n  border-radius: 50%;\n  background: #4CAF50;\n  cursor: pointer;\n  transition: background 0.2s;\n  margin-top:-5px;\n}\n\ninput[type=\"range\"]::-webkit-slider-thumb:hover {\n  background: #3e8e41;\n}\n\ninput[type=\"range\"]::-webkit-slider-runnable-track {\n  height: 10px;\n  background: #ddd;\n  border-radius: 5px;\n  border: none;\n}\ninput[type=\"checkbox\"] {\n  appearance: none;\n  width: 45px;\n  height: 25px;\n  background: transparent;\n  border: 2px solid;\n  border-image: linear-gradient(to right, #06c, #f90) 1;  border-radius: 5px;\n  margin: 10px;\n  outline: none;\n  cursor: pointer;\n  position: relative;\n}\n\ninput[type=\"checkbox\"]:before {\n  content: \"\";\n  width: 15px;\n  height: 15px;\n  background: #D209A4;\n  border-radius: 100px;\n  position: absolute;\n  left: 2px;\n  \n  top: 3px;\n  transition: all 0.2s;\n}\n\ninput[type=\"checkbox\"]:checked:before {\n  transform: translateX(20px);\n}\n\ninput[type=\"checkbox\"]:focus {\n  border: 2px solid #888;\n}\ninput[type=\"radio\"] {\n  appearance: none;\n  width: 20px;\n  height: 20px;\n  border-radius: 50%;\n  border: 2px solid #333;\n  margin-right: 10px;\n  outline: none;\n  position: relative;\n  cursor: pointer;\n}\n\ninput[type=\"radio\"]:after {\n  content: \"\";\n  width: 10px;\n  height: 10px;\n  border-radius: 50%;\n  background: #333;\n  position: absolute;\n  top: 5px;\n  left: 5px;\n  opacity: 0;\n  transition: all 0.2s;\n}\n\ninput[type=\"radio\"]:checked:after {\n  opacity: 1;\n}\n\ninput[type=\"radio\"]:focus {\n  border-color: #888;\n}\n\n\ninput[type=\"radio\"] {\n  display: inline-block;\n  margin-right: 10px;\n  vertical-align: middle;\n}\n\nlabel {\n  display: block; \/* makes each label appear on a new line *\/\n  font-size: 16px;\n  font-weight: bold;\n  margin-bottom: 5px; \/* adds a small gap below each label *\/\n  color:#55555e;\n  margin-top:11px;margin-bottom:11px;\n}\n\ninput[type=\"color\"]{width:17.2%;}\n.form-control {\n    display: block;\n    margin:0 auto;\n    width: 70%;\n    padding: 0.375rem 0.75rem;\n    font-size: 1rem;\n    font-weight: 400;\n    line-height: 1.5;\n    color: #212529;\n    background-color: #fff;\n    background-clip: padding-box;\n    border: 1px solid #ced4da;\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none;\n    border-radius: 0.25rem;\n    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;\n}\nsection{\n         margin-top:60px;\n        width: 100%;\n        max-width: 970px;\n        background-color: #fff;\n        border: 1px solid #ddd;\n        padding: 25px;\n      }\n<\/style>","protected":false},"excerpt":{"rendered":"<p>Justify Text Tool Font: ArialHelveticaTimes New RomanGeorgiaVerdana Font Size: 1214161820 Line Height: Single1.5Double Upload File: Justify Text Copy Text<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","footnotes":""},"class_list":["post-618","page","type-page","status-publish"],"taxonomy_info":[],"featured_image_src_large":false,"author_info":{"display_name":"Billions Ideas","author_link":"https:\/\/tools.billionsideas.com\/de\/author\/loginbillionsideas-com\/"},"comment_info":0,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tools.billionsideas.com\/de\/wp-json\/wp\/v2\/pages\/618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tools.billionsideas.com\/de\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tools.billionsideas.com\/de\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tools.billionsideas.com\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tools.billionsideas.com\/de\/wp-json\/wp\/v2\/comments?post=618"}],"version-history":[{"count":0,"href":"https:\/\/tools.billionsideas.com\/de\/wp-json\/wp\/v2\/pages\/618\/revisions"}],"wp:attachment":[{"href":"https:\/\/tools.billionsideas.com\/de\/wp-json\/wp\/v2\/media?parent=618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}