Howto: Code a tableless website part 1
Howto January 22nd, 2008Preface
In this tutorial, I will teach you how to code a website without any tables. We will use CSS and <div> tags instead. The sample website we’re going to build consists of a header, navigation system on the left, and the main content on the right. Also a footer is added. I asume you already have basic or decent experience with HTML coding.
Get started
Let’s start off by creating two files. One will be the CSS file and one will be the HTML file. Now make your HTML look like the following code.
1 2 3 4 5 6 7 8 9 10 11 | <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> <title>Tablesless Website</title> </head> <body> <div id="container"> Hello </div> </body> </html> |
For styling we use the HTML <div> tags and we use CSS. As you can see I gave the <div> an id. Id’s are always unique. There can only be one id. We’re now going to give this <div> a styling. Enter the following code inside your CSS file and then save it as ’style.css’ in the same folder as your html file. The <link> tag inside your <head> in the HTML file includes the CSS file.
1 2 3 4 5 6 | /* We use the # when we define the styling of an id */ #container { width: 700px; margin-left: auto; margin-right: auto; } |
Explanation: Everything between the brackets are given to the specified tag before it. In this example we give the ID, container a width, margin-left and margin-right. The width specifies the width of the container (orly!). Margins define space between the specified tag and the element next to it. In this case the element next to <div id=”container”> is <body>. By setting the margin-left and margin-right at ‘auto’, #container will order perfectly in the middle of the sample website.
View the sample here.
November 4th, 2008 at 3:29 am
This is not enough i dont understand the example which you linked some more content yaar, no hello some thing more content
thanks for the code which you explained i.e usefull that i can say
March 31st, 2009 at 3:46 am
Мухахахаха, да вы у нас философ аффтар?
April 1st, 2009 at 2:27 pm
Да уж По-моему, минусы намного превосходят плюсы. Думаю, не стоит заморачиваться.
April 6th, 2009 at 11:29 pm
Да, таких интересных блогов я невидел! Этот блог даст фору многим сайтам ( по содержанию и не только)! Пять баллов!
April 12th, 2009 at 12:03 am
Давно искал эту информацию, Спасибочки за Вашу работу.
April 21st, 2009 at 9:14 am
С большинством Ваших постов я не согласен, но этот пост пришелся по душе
April 22nd, 2009 at 10:18 pm
Познавательная статья, мне кажется что вам нужно в какие нибудь спец журналы писать
April 25th, 2009 at 5:11 pm
I was wondering if you could set up some sort of system so when your publish a new article, i get emailed to alert me?
May 12th, 2009 at 11:33 am
Очень познавательно. =) Спасибо.
May 19th, 2009 at 7:41 pm
Любопытно, откедова такое чудище вылезло?
May 21st, 2009 at 3:57 am
Моя технология немного отличается от изложенной автором, кому интересно, могу поделиться своими экспериментами. Мой email:santa_box@mail.ru, Виталий.
May 23rd, 2009 at 4:42 pm
Благодарю. Появилась хорошая идея, но она требует полной реорганизации предыдущей идеи, займусь в выходные. Скоро поделюсь с читателями блога!
May 23rd, 2009 at 4:59 pm
Извините за оффтоп, не подскажете, где мона такой же симпатичный шаблон для блога взять?
May 24th, 2009 at 12:12 am
Мне срочно надо подискутировть с кем-либо по обсуждаемому вопросу. Если есть желающие, пишите в асю 45119424
May 28th, 2009 at 4:45 am
Занятно написано, на самом деле все прочитал буквально на одном дыхании
May 28th, 2009 at 7:04 pm
I really liked this post. Can I copy it to my site? Thank you in advance.
May 31st, 2009 at 8:06 am
Видел репортаж в новостях по ТВ. Долго ржал
Все гениальное просто!
June 4th, 2009 at 10:30 pm
Hi, good post. I have been wondering about this issue,so thanks for posting.
June 5th, 2009 at 8:10 pm
Придуманная мной идея незначительно отличается от описанной автором, кому интересно, могу поделиться своими мыслями. Мой мыл:rvl@corbina.ru, Cергей.
June 10th, 2009 at 9:21 am
Сравнительно недавно попал на Ваш сайт, теперь каждое утро захожу посмотреть, не написали ли чего новенького.
К сожалению только Вы не каждый день свой сайт обновляете 
June 12th, 2009 at 11:56 pm
Original post by Dmitri Gromov
June 15th, 2009 at 8:30 am
Hi, interest post. I’ll write you later about few questions!
June 17th, 2009 at 2:24 am
Хорошо! Все бы так писали
June 18th, 2009 at 12:42 pm
Very interesting… thanks.
June 20th, 2009 at 5:03 am
Что-то у меня в Firefox дизайн вашего сайта расползается…
June 22nd, 2009 at 12:17 pm
Кртуо!:) Но есть и минус ! У меня скорость интернета 112 кбит/сек. Страница грузилась около 15 секунд.
June 24th, 2009 at 2:45 am
Я совершенно случайно зашел на этот сайт, но задержался тут надолго. Задержался, потому что все очень интересно. Обязательно скажу о вас всем своим приятелям.
June 28th, 2009 at 6:45 pm
Ну, как сказать, понравилось
Хотя я все равно практически ничего не понял. 