Sunday, October 20, 2019
How to Format PHP Text
How to Format PHP Text So youve gone through the PHPà tutorialsà or are new to PHP in general, and you can make some nifty things in PHP, but they all look like plain text. How do you jazz them up? Formatting PHP text isnt done with PHP; its done with HTML. You can do this in two ways. You can add HTML inside the PHP code or you can add the PHP code inside the HTML. Either way, the file must be saved as a .php or another file type that is allowed to execute PHP on your server. Changing PHP Text Color Using HTML Inside PHP For example, to change the PHP text color to red. Hello World!; ? In this case, the hex color number #ff0000 sets the PHP text that follows it to red. The number could be replaced by otherà hex color numbers for other colors. Notice the HTML code is located inside the echo.à Changing PHP Text Color Usingà PHP Inside HTML The same effect is achieved with the following code, which uses PHP inside HTML. In the second example, a single line of PHP is inserted inside the HTML. Although here it is only a line to make the text red in this example, it could be inside a fully formatted HTML page to get any look you want. Types of Formatting Available in HTML It is easy to make text formatting changes to PHP text inside HTML. Although many of these formatting commands have been suspended in Cascading Style Sheets, they all still work in HTML. Some of the text formatting commands that can be used include: Bold - Italic -à à Underline -à Strike-out -à orà Small -à Font size -à , replace the ? with a number from 1 to 7, 1 being the smallestCenter text -à A complete list of text formatting tags is available.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.