How to Use DIV to Center Links
Centering a line of text on a Web page makes it stand out from other content on the page. A centered headline or link will draw the attention of visitors browsing your website. Centering a link on a page doesn't have to be difficult. You can use the "div" attribute to center an important link or other text. Learn how to center links on a Web page using a div tag in a few easy steps.
Instructions
-
-
1
Open the Web page you want to edit in Notepad or your preferred text or HTML editor. Click to place your cursor on a new line in the document. Make sure the previous line ends with a closing "</p>" or "" tag to start a new paragraph or line.
-
2
Type the following code at the beginning of the new line:
<div align="center">
-
-
3
Type the following immediately after the code in the preceding step:
<a href="http://www.example.com">Click Here</a>
Replace "http://www.example.com" with the URL that you want to center on your page, and replace "Click Here" with the anchor text you want to use.
-
4
Type a closing "</div>" tag immediately after the closing </a> tag in the preceding step. The finished HTML code for your centered link should look similar to the following:
<div align="center"><a href="http://www.example.com">Click Here</a></div>
-
5
Save the page you are editing and upload it to your Web server. View the page in a browser to ensure that you've coded the div tag correctly and the link is centered on the page.
-
1
Tips & Warnings
Use the technique described in this article to center a headline or any block of text on a Web page.