Lesson 24 – A Simple Div
Posted by cssbytes on September 22, 2007
Divs are actually used all over the internet. They are a brilliant way of doing many things, and are probably the most popular way of formatting a webpage, (aside from flash perhaps). But flash can get very annoying, and it is very difficult to code. I would show you how to code it, but I’d need someone to show me how, first!
Probably the most simple div I can show you, is a div that will align things to the left, or right, or center. They can also be used to align ‘justify’, like on Microsoft Word, but this only works with text. The rest will work with tables, paragraphs, images, almost anything you can think of. It does save a lot of time, because then you don’t have to put ‘<p align=”center”>’, for instance, all of the time. And here is the code for an aligning div:
| <div align=”center“>Anything you want to be aligned center, should go here.</div> |
- Pretty self-explanatory, isn’t it? The text in bold, (in between the inverted commas), can be changed to left, right, or justify (only for text, though), to suit you.
These are really useful to align what you want. I generally find myself using them to align several things to the same place, so that I can save myself some typing (yeah, I’m lazy). So anyway, that’s enough for simple divs. Bye.
AJ Cann said
Please could you cover the float tag as I’m having problems understanding it. Thanks.
cssbytes said
Ok, I’ll give you a post about it later.
cssbytes said
Ok, I’ve done a little research on Floating, and I think it would be best if I write you a post about it, after I’ve done a little more about Divs, and ID’s.
Lesson 25 - ID’s (Part One) « CSSBytes said
[...] Top Posts Lesson 4 – Hex Colours V Colour NamesLesson 1 – What are HTML & CSS?Lesson 5 – Writing HyperlinksLesson 9 – Images & HTMLLesson 17 – Non-Repeating BackgroundsLesson 16 – Tiled Image BackgroundsLesson 24 – A Simple Div [...]