Internet, Networking, & Security Web Development Align and Float Elements on Your Web Page By Jennifer Kyrnin Freelance Contributor Jennifer Kyrnin is a professional web developer who assists others in learning web design, HTML, CSS, and XML. our editorial process LinkedIn Jennifer Kyrnin Updated July 12, 2019 Andy Roberts / Getty Images Web Development CSS & HTML Web Design SQL Tweet Share Email The placement of items on a web page is essential to its overall design. Though there are other ways to influence the layout, such as to use tables (which we don't recommend), the best is to use CSS. Below, we'll take a look at how to use a simple CSS style in-line property to align images, tables, paragraphs, and more. These same methods can be used on external style sheets too but since these apply to individual items and likely need to stay that way, it's best to use in-line styling like what's mentioned below. Align Text Paragraphs The paragraph tag is the first place to start in laying out your web page. It opening and closing tags look like this: The default alignment of text in a paragraph is to the left side of the page, but you can also align your paragraphs to the right and center. Using the float property lets you align paragraphs to the right or left of the parent element. Any other elements inside that parent element will flow around the floated element. To get the best effect with a paragraph, it's best to set a width on the paragraph that's smaller than the container (parent) element. Align the Text Inside Paragraphs Arguably, the most interesting alignment for paragraph text is "justify," which tells the browser to display the text aligned, essentially, to both the right and left sides of the window. To justify the text in a paragraph, you would use the text-align property. You can also align all the text inside a paragraph to the right side or the left (the default), using the text-align property. The text-align property will align the text inside the element. Technically, it's not supposed to align images that are contained inside the paragraph or other elements, but most browsers treat images as inline for this property. Aligning Images Using the float property on an image tag you can define the placement of images on the page and how the text will wrap around them. Just like the paragraphs above, the float style property in the image tag will position your image on the page and tells the browser how to flow text and other elements around that image. Text following the above image tag will flow around the image to the right as the image displays to the left of the screen. If I want the text to stop wrapping around the image, I use the clear property: Aligning More Than Paragraphs However, what if you want to align more than just a paragraph or an image? You could simply put a style property in every paragraph, but there is a tag you can use that is more effective: Simply surround the text and images (including HTML tags) with the tag and the style property (float or text-align) and everything in that division will be aligned how you'd like it. Keep in mind that alignments added to paragraphs or images within the division will be honored, overriding the tag.