Div tags
Post Reply
Quote
Re: Div tags
Posted by Loco on Sun Oct 23rd at 1:46pm 2005


I'm building a site from scratch, and have been trying out div tags. It all works fine, until I try and use vertical alignment which er... won't. I'm trying to get it so the text in a div box is in the center vertically, but I can't seem to get it to work. A lot of tutorials out there say that the vertical-align tag isn't really supported, so how is it done? I have already Googled this, before anyone asks. Any ideas?






Quote
Re: Div tags
Posted by azelito on Sun Oct 23rd at 2:00pm 2005


Not quite sure I understood your question but...
http://www.w3schools.com



"Azelito, stop being a f**king bitch. All I see you do is complain and insult people in your recent posts. We don't care, go find a razor you emo pansy..." -Windows98



Quote
Re: Div tags
Posted by Underdog on Sun Oct 23rd at 2:19pm 2005


I can only code pages with HTML and that only at a beginner to intermediate level. (perhaps that makes me a full web page designer as well, huh Maze. with restrictions of course. )

I have no clue what you asked either. Sorry.

Good luck.




There is no history until something happens, then there is.



Quote
Re: Div tags
Posted by Loco on Sun Oct 23rd at 2:29pm 2005


Sorry, should have been more specific. I have div block - nice, shiny, clean and empty. I need to shove some text in this (fine), but have it centered vertically, and I have no idea how to do this.






Quote
Re: Div tags
Posted by Underdog on Sun Oct 23rd at 2:32pm 2005


There are no align right, or align left tags?

I suppose that I need to look up what you are asking because "div" is throwing me.

[edit] Found this. Didn't enlighten me one iota.

Good luck my friend.




There is no history until something happens, then there is.



Quote
Re: Div tags
Posted by Loco on Sun Oct 23rd at 2:45pm 2005


Thanks for the suggestions, but I've just about managed to crack it.

A set of div tags is used to create a block of text or content wherever you want. For example, I'm using the following for the header block on the website I'm building:

<div id=layer1 style="position:absolute; top:0; left:0; width:100%; height:200; z-index:1; padding:0px; background-color:#000000; background-image:url(img/bannerback.jpg); layer-background-image:url(img/bannerback.jpg);">

Title goes here

</div>

What I wanted to do is edit the title so that it is vertically in the center of the block, rather than stuck at the top.

The solution is a little messy. Tables support vertical aligning, so I have a mini invisible table within the div tags which vertically centers the text. As I said - messy. Any other better methods?






Quote
Re: Div tags
Posted by Underdog on Sun Oct 23rd at 2:50pm 2005


Hmm, thats now as clear as Los Angeles on a mid summer day.

Can you post a link to a before/after so I can see it in action?

Sounds an awful lot like "tables" to me.




There is no history until something happens, then there is.



Quote
Re: Div tags
Posted by Loco on Sun Oct 23rd at 3:02pm 2005


Here's the before and after
http://bobloco.freeunixhost.com/before.php
http://bobloco.freeunixhost.com/after.php

Like I said - messy. divs are a bit like tables, only you aren't limited by a giant box and they're a bit nicer to work with (most of the time). I've only just started using them myself.






Quote
Re: Div tags
Posted by Crono on Sun Oct 23rd at 7:18pm 2005


Divs are something else besides tables. Much easier to use them with dynamic content. Since you can label an entire part of the page a class and move it around as well as put it infront or behind other objects on the page. (even though you can do that with a table too)

If you want the same thing, but no break in the page, use a span tag.

You should be able to specify padding as "50%" and it will center in the middle. It's a little shadey sometimes. But it should work.



Blame it on Microsoft, God does.




Post Reply