CSS - Centered Tableless Template & Opacity

Commonly if we wanna center the website template using table, we will always add the ‘align’ property of table and give its value with ‘center’. With this kind of property, the template will surely view in center align and without do anything else.

<table align=”center”>
<tr><td>example</td></tr>
</table>

The above is a way for us to center the template while we are using table in developing template. How about developing a template using tableless concept? We still got solution here. hehe…

We use <div> tag with CSS controlling to replace table in developing tableless template. How does tableless template will be formed then? Maybe i will write about the basic development of tableless template in my next post. Now i will only show you how to centered the tableless template. Look into following script :

<style type=”text/css”>
#container{
width:800px;
margin-top:0px;
margin-left:auto;
margin-bottom:0px;
margin-right:auto;
padding:0px;
}
</style>

<html>
<head></head>
<body>
<div id=”container”>The layout centered</div>
</body>
</html>

In the above script, width & margin properties of id container play important role in centered the layout. Width property defines the wide of your layout you want to form. Margin property helps in setting the margin surrounded id container within width 800px. Margin at the top and bottom side will remain 0px (you can set whatever you want according to your needs), while Margin at the left and right side have to remain auto because within ‘auto’ value in these two properties, the layout will automatically set a balance margin between the left and the right side for you. Therefore you will have a centered layout with width 800px.

Ok… we continue with the opacity matter by using CSS. I found out the opacity property was very usefull for me in developing HerlinaWijaya.com template. It makes my template become more artistic, hehe… do you agree with me? That’s just some trick i put it into my template css and blink… amazing… It’s look like i have done some slicing with photoshop. Look at my print screen below.

HerlinaWijaya.com HerlinaWijaya.com

Here i will show you the opacity tricks in CSS those support in browser Internet Explorer, Mozilla, and also Opera. Do take in mind, use the opacity property in the id or class that you wanna its layout looks more transparancy.

/* Opacity in Internet Explorer */
filter: alpha(opacity=80);
zoom: 1;
/* Opacity in Mozilla */
-moz-opacity: 0.8;
/* Opacity in Opera*/
opacity:0.8;

Practice makes perfect. Do more practice and you will learn more. :D

Maybe you have any other trick according this topic, kindly put your comment below :)


5 Responses to “CSS - Centered Tableless Template & Opacity”

  1. little star Says:

    Great tips! Tweaking the element’s opacity is somewhat an interesting design. :)

    By the way, can you also share about how to make PNG alpha transparency works in IE6? I’ve googled a lot of tricks recently, but they seems not so looking good for me. I am sick with those messy code that very difficult to understand, if possible, I prefer the little code one. :)

  2. Endri Says:

    wah.. maap… bahasa lingisnya kacau, jadi komen dalam indo aja ya.

    INTINYA..

    NICE TIPS

  3. axing Says:

    Wow! Thanks for your tips.

    But here I have a question, most people say that using tableless layout is better than layout that using table element. So, what is the benefit by using tableless layout rather than using table?

  4. Lina Says:

    @little star, axing
    thanks for your praising :D
    i’m interesting to answer your both question and trick in my next post. So be patient :D

    Do often come and check out the new post. :)

    @endri
    Gapapa lar
    Gw juga lagi belajar b.inggris kok.
    Thx banget ya uda kunjungi website gw :D
    Sering2 mampir ya.

  5. axing Says:

    Ok! I will be waiting for your next post.

    Cheer! ;)

Leave a Comment

    About Me

    I am an undergraduate student in UIB. Currently work as a web editor. Joomla is my daily meal in office. Because of this job, i become addicted in all of the topic about website. Wanna know me more and make friend with me? Click here. :D

    Calender

    July 2008
    M T W T F S S
        Aug »
     123456
    78910111213
    14151617181920
    21222324252627
    28293031