Learn HTML step-by-step from A to Z or improve your professional skills.  Home HTML and CSS Tutorials Build Fixed Columns
Your Ad Here

Build Fixed Columns


Build Fixed ColumnsWhen it comes to how to freeze the width of your columns, rather than allowing them to resize on their own, you must know that it is a very easy thing. How can you do that? Follow these steps:

  • Use a property value of the position: absolute.
  • Now specify what will be the position and the size of your new column - In other words, set values for the left, top and width properties in pixels or inches.

The result will be something like the following piece of code:

.topheadline {
position: absolute;
top: 10;
font: bold 48px/.99 "Courier New";
letter-spacing: -.02em;
padding: 10px;
}
.leftcolumn {
position: absolute;
top: 75px;
left:15px;
width:400px;
text-align: right;
}
.rightcolumn {
position: absolute;
top: 75px;
left:430px;
width:400px;
text-align: left;
}

Remember! Whenever you are using the absolute positions, you should make sure that the left property of the certain column works as it is supposed to. In the code above I have highlighted the exact places where you should be paying most of your attention - let's say you have a first column of an x width (in our case 400px). To this x value it will be added the left value (15px in our case) which we will name y. Until now we have 1st width value plus 1st left space leading to a total of 415, therefore the second column will start somewhere at 430px. You continue doing the math in the same way as with these two columns if you want to add a third or a fourth column. Another thing you should keep in mind is that whenever you are using these absolute positions, any kind of padding will be ignored.

Now, let's assume that you want to add several columns under these that we already talked about. You will be required to add several additional classes for these new columns. The two columns shown above have specific classes in this code - leftcolumn and rightcolumn. These classes have specified a certain top property which in this case is 80 px. Obviously, in order to insert columns below the already existent ones, you will need to enter a value lager than the top property value.

When does the "absolute" part actually kick in? Well, let's say that the user's that is browsing your website wishes to resize his browser window - in this case, you will see how "absolute" affects your columns. They will remain at the size that you set in the first place, without being affected by the resize.



About the Author:

Webzo Studio is a web design company located in the United States. Webzo Studio was founded in August 2005. We are a small team of designers that just love our job. The love of doing what we do is what makes us not doing our job as a job, but as an enjoyment.
read more about this author

Author's URL: Webzo Studio
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
Share print this page subscribe to newsletter subscribe to rss

Learn HTML step-by-step from A to Z or improve your professional skills. More HTML and CSS: Most Popular Materials | Fresh Materials | More HTML Tutorials at Markuptutorials.com

No comments yet...
Add comments to "Build Fixed Columns"

Captcha