Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Old 04-24-2007, 05:30 PM Margin tag
Extreme Talker

Posts: 161
Trades: 0
Could some tell me how this code centers something, ie this header.

Code: margin: 0 auto;

I don't understand why this would center my image.
thanks for any help.
afcbob is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-24-2007, 05:58 PM Re: Margin tag
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
It works in conjunction with a width property (by the way, margin is a property too.) 0 refers to the top and bottom margins (so there are no margins above or below your element) and auto refers to the left-right margins (50% of the remaining space goes to the left of the element, and 50% to the right of the element.)

For example:
Code:
margin:  0px auto;
width:  50%;
means that the element will be 50% of the width of its container, with 25% margins on the left and right sides.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 04-24-2007, 07:03 PM Re: Margin tag
Extreme Talker

Posts: 161
Trades: 0
Thanks for that.
afcbob is offline
Reply With Quote
View Public Profile
 
Old 04-25-2007, 05:44 AM Re: Margin tag
Extreme Talker

Posts: 161
Trades: 0
OK would the hole thing to site in the middle of the screen but tried this

Code:
margin:  auto auto;
width: 600px;
height: 300px;
What i'm i doing wrong.
afcbob is offline
Reply With Quote
View Public Profile
 
Old 04-25-2007, 06:15 AM Re: Margin tag
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
What i'm i doing wrong.
Nothing, it just won't work at all

BTW what's a margin tag?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-25-2007, 06:27 AM Re: Margin tag
Extreme Talker

Posts: 161
Trades: 0
Would it not be best to put why it would not work.

Margin tag is for creating a margin around a item.
afcbob is offline
Reply With Quote
View Public Profile
 
Old 04-25-2007, 07:37 AM Re: Margin tag
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
It won't work because you can't apply an auto value for the top and bottom margins.

Quote:
Margin tag is for creating a margin around a item
No it isn't. There is no such thing as a margin tag.
It is either;

an attribute of a visual HTML element tag

or

A CSS property of a style that can be applied to visual HTML elements
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-25-2007, 09:27 AM Re: Margin tag
Extreme Talker

Posts: 161
Trades: 0
Ok thank you will try something else to get it right.
afcbob is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Margin tag
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26479 seconds with 12 queries