Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-30-2012, 03:47 PM   PM User | #1
Rasly
New to the CF scene

 
Join Date: Jan 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rasly is an unknown quantity at this point
NEED HELP, divs, text-align, shyt

I am out of freaking ideas, im trying to do something VERY SIMPLE, but looks like i am a freaking idiot after all, so i ask you for help!!!!Q!!!!!


i have html code like this:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body>

	<div style="text-align:center;">
    	<div style="border:solid 1px #333; width:100px;">dsfgd</div>
    </div>
    
</body>
</html>
BUT WHAT I GET IS THIS:




SOMEONE please tell me why it dosnt work!!!!! ????? thanks is advance
Rasly is offline   Reply With Quote
Old 01-30-2012, 04:16 PM   PM User | #2
teedoff
Senior Coder

 
Join Date: Aug 2010
Location: High Point, NC
Posts: 3,325
Thanks: 5
Thanked 363 Times in 360 Posts
teedoff is on a distinguished road
umm What are you TRYING to achieve? What isn't working about it?

You have a solid 1px border around your text which is aligned center and 100px wide.

That longer dotted border is what you see in dreamweaver yes?
__________________
Teed
teedoff is offline   Reply With Quote
Old 01-30-2012, 05:42 PM   PM User | #3
Rasly
New to the CF scene

 
Join Date: Jan 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rasly is an unknown quantity at this point
Quote:
Originally Posted by teedoff View Post
umm What are you TRYING to achieve? What isn't working about it?

You have a solid 1px border around your text which is aligned center and 100px wide.

That longer dotted border is what you see in dreamweaver yes?
It should have been in the middle, not on left, well i got it fixed now, by writing "margin: 0 auto;" in second div, now im tryng to understand how margin effects text align.
Rasly is offline   Reply With Quote
Old 01-30-2012, 06:20 PM   PM User | #4
teedoff
Senior Coder

 
Join Date: Aug 2010
Location: High Point, NC
Posts: 3,325
Thanks: 5
Thanked 363 Times in 360 Posts
teedoff is on a distinguished road
The margin you used didn't affect the text-align. You used the text-align: center; on the containng div, therefore the second div inherited that style. To see that, remove the first div completely, and the text will then by default be aligned left.
__________________
Teed
teedoff is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 06:50 AM.


Advertisement
Log in to turn off these ads.