Javascript examples for CSS Style Property:textAlign
Return the text alignment of a <p> element:
<!DOCTYPE html> <html> <body> <p id="myP" style="text-align:right;">This is an example paragraph.</p> <button type="button" onclick="myFunction()">Return text alignment of p</button> <script> function myFunction() {/*from w w w. ja v a2s .c om*/ console.log(document.getElementById("myP").style.textAlign); } </script> </body> </html>