CSS Aligning

This is a discussion on "CSS Aligning" within the Web Page Design section. This forum, and the thread "CSS Aligning are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 18th, 2008, 14:43
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
CSS Aligning

I'm in the middle of learning css and applying it to the site and I am trying to figure out how I can align to the left, align to the right, to the middle, and how to state the height and the width using css.

I have looked on various sites and all I can seem to find is some info on margins. I'm really new to css and any help would be great. If you could check out my site using the validation checker and explain some of my errors for me and how to correct them that would be fantastic.

Wes

PS. I maybe being really stupid here, so I apologize
Reply With Quote

  #2 (permalink)  
Old Jan 18th, 2008, 16:22
Junior Member
Join Date: Jan 2008
Location: Northern Ireland
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

Well i know to center a div you have to put this css:

Code: Select all
#div{
margin: 0 auto;
}
Hope that helps, also, what is your site?
Reply With Quote
  #3 (permalink)  
Old Jan 18th, 2008, 16:57
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

Ok, well I'll give it a go thanks. Just need to find out now how to left align, right align, height, and width.

Wes
Reply With Quote
  #4 (permalink)  
Old Jan 18th, 2008, 17:06
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

Well ... it depends on what you want to achieve. To align text left, right or center, just use the text-align property.

As for height and width ... well ... those properties exists in css as well.
Reply With Quote
  #5 (permalink)  
Old Jan 18th, 2008, 17:10
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

Hi Karinne,

It's the same issue with the validator that I was talking about the other week. I have used the strict doctype you suggested and I have begun to edit it to correct the errors and one of the errors that shows up is using text alignment and the height and width of tables. It says I need to use css to get the same the same effect.

I need to figure out what code I need to use to align to the left, to the right, to the center, and also the width and height issues.
Reply With Quote
  #6 (permalink)  
Old Jan 18th, 2008, 17:11
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

Could you post the link again?
Reply With Quote
  #7 (permalink)  
Old Jan 20th, 2008, 15:19
Junior Member
Join Date: Jan 2008
Location: Northern Ireland
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

Do you want to align tables?
Reply With Quote
  #8 (permalink)  
Old Jan 20th, 2008, 16:34
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: CSS Aligning

You need to asign things using CSS. EG:
Instead of
Code: Select all
<table height="400">
Use CSS!
Code: Select all
table {
height: 400px;
}
HTH
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #9 (permalink)  
Old Jan 20th, 2008, 19:04
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

Karinne,

The link is www.weightgain4you.com

Thanks
Reply With Quote
  #10 (permalink)  
Old Jan 20th, 2008, 19:21
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

FX Design,

I am talking about everything, not just tables. Text, images, tables, etc.

Wes
Reply With Quote
  #11 (permalink)  
Old Jan 20th, 2008, 19:22
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

jackfranklin,

cheers for that. Were is that written? Is it in the actual stylesheet itself? If so, how to you apply it to the table you want to align?

Cheers,
Wes
Reply With Quote
  #12 (permalink)  
Old Jan 20th, 2008, 19:25
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: CSS Aligning

You add the CSS to the stylesheet. To apply it to all tables, you would just use:
Code: Select all
table {
width: 400px;
}
Or to use it on a specific table, you could give the table an id in the HTML:
Code: Select all
<table id="table1">
And apply the CSS to just the table with that id:
Code: Select all
#table1 {
width: 400px;
}
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #13 (permalink)  
Old Jan 20th, 2008, 19:28
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

ok, jack thanks for that. What abou text, and image alignment? I need to know how to do the height and the width for the same.
Reply With Quote
  #14 (permalink)  
Old Jan 20th, 2008, 19:35
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: CSS Aligning

Images can be done using a similar style. To style all images:
Code: Select all
img {
style for images here
}
Or can give the image an id :
Code: Select all
<img src="path/to/image.jpg" id="image">
And style like so:
Code: Select all
#image {
...
}
For text just use the text-align CSS property.
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #15 (permalink)  
Old Jan 20th, 2008, 19:45
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

cheers, so let have a go at writing some down and tell me if I'm on the right track

If I wanted to align all tables to the left I would write:

table {
align: left;
}
Reply With Quote
  #16 (permalink)  
Old Jan 20th, 2008, 19:49
Junior Member
Join Date: Nov 2007
Location: UK, Greater Manchester
Age: 21
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Aligning

jack,

would you mind checking out some of the errors in validator?
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Aligning box to right fr33sty13 Web Page Design 8 Jun 6th, 2008 03:49
Aligning content fr33sty13 Web Page Design 5 Apr 26th, 2008 14:01
Aligning scrollbars Ola JavaScript Forum 4 Feb 29th, 2008 16:16
[SOLVED] Aligning to the very top thewebkid Web Page Design 4 Dec 23rd, 2007 08:48
GD Aligning? PicoDeath PHP Forum 3 Aug 2nd, 2007 16:14


All times are GMT. The time now is 16:34.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43