Skip to content Skip to sidebar Skip to footer

Aligning Elements Side By Side In HTML

I am working on a website(this is my first website as a developer) and I was wondering if someone could help me align these to items next to each other horizontally. I don't know h

Solution 1:

Typically when you want to line something up side by side on a page, you have two options:

  1. The old school way - Use Tables (If you are using a program like Dreamweaver, this should be fairly easy - Insert > Table)
  2. The better way - Using CSS. This may be a little harder for you to deal with since you said you have no experiencing working with HTML and I am presuming CSS.

The CSS way would require you to create a stylesheet with two divisions (divs). Here's an example of some code that would do that:

<style>
 #col1{ width:300px; float:left;}
 #col2 { width:300px; float: right;}
</style>

The above code would go between your <head></head> tags. Then in the body of your page, you would simply call the two divs:

<div id="col1">YOUR CONTENT</div>
<div id="col2">YOUR CONTENT</div>

Solution 2:

I had a similar problem. I tried to use the CSS route but failed. If you are using Wordpress the easiest way would be to place 2 columns in the section you want the division. then place one element in each and then target their HTML codes accordingly.


Post a Comment for "Aligning Elements Side By Side In HTML"