CSS problem

  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post April 16th, 2008, 2:08 pm

I am trying to center some text... :lol: shouldn't be hard except the server doesn't spit the darn thing out... Below is what I'm trying...
HTML Code: [ Select ]
<span style="text-align: center;"><strong>category</strong><br /></span>

I tried text-decoration: bold; rather than strong but the CSS inside the style doesn't work. I also tried the span as a class and used the following class CSS definition.
Code: [ Select ]
.center {
text-align: center;
text-decoration: bold;
}
  1. .center {
  2. text-align: center;
  3. text-decoration: bold;
  4. }

I have no clue why it doesn't work. Should work by theory but it doesn't :x
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post April 16th, 2008, 2:08 pm

  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2194
  • Loc: Canada
  • Status: Offline

Post April 16th, 2008, 2:21 pm

CSS Code: [ Select ]
font-weight: bold;
 
  1. font-weight: bold;
  2.  
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post April 16th, 2008, 2:25 pm

The bold thing works, but it doesn't center...
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2194
  • Loc: Canada
  • Status: Offline

Post April 16th, 2008, 3:00 pm

HTML Code: [ Select ]
<p align="center" style="font-weight: bold">
 
  1. <p align="center" style="font-weight: bold">
  2.  

?
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post April 16th, 2008, 3:06 pm

That works but now it's not XHTML valid :(

[EDIT] I fixed it... I use <p style="font-weight: bold; text-align: center; margin: 0 0 0 0;">Category</p> Thanks for your help neksus :)
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6130
  • Loc: Seattle, WA
  • Status: Offline

Post April 16th, 2008, 3:16 pm

The reason it wouldn't center before is because when you specify text-align: center in the <span>, you're specifying that any text contained in the <span> should be centered within it, but the <span> itself would still be aligned according to its parent container's text-align property.
The Beer Monocle. Classy.
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2194
  • Loc: Canada
  • Status: Offline

Post April 16th, 2008, 3:19 pm

margin: 0 is the same as margin: 0 0 0 0 as well ;)
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post April 16th, 2008, 3:28 pm

spork wrote:
The reason it wouldn't center before is because when you specify text-align: center in the <span>, you're specifying that any text contained in the <span> should be centered within it, but the <span> itself would still be aligned according to its parent container's text-align property.

Well, that makes sense :) Thanks for that heads up. I appreciate it.
neksus wrote:
margin: 0 is the same as margin: 0 0 0 0 as well ;)

Yeah, I know. I don't know what I was thinking :lol:
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • nardar
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Apr 18, 2008
  • Posts: 5
  • Status: Offline

Post April 26th, 2008, 3:40 am

Tell me about the difference between margin and padding
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2194
  • Loc: Canada
  • Status: Offline

Post April 26th, 2008, 7:13 am

Check out this display of the box model.
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post April 26th, 2008, 2:35 pm

Padding is the set space between the text and the border of the DIV and margin is the space outside of the border of the DIV.

(Neksus's explanation is very well).
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2194
  • Loc: Canada
  • Status: Offline

Post April 27th, 2008, 8:56 pm

If you ever can't get something to look right, you may want to read up on collapsing margins as well.
  • nardar
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Apr 18, 2008
  • Posts: 5
  • Status: Offline

Post April 27th, 2008, 11:35 pm

please answer me that I don't want to set the height of wrapper <one of div over body, but the container of mainbody > but when i fill the footer, i cannot search it and i always place the fixed position like that "position:absolute" and if i wrote "position:relative"IE 6 didn't work well Why? :shock:

Post Information

  • Total Posts in this topic: 13 posts
  • Users browsing this forum: No registered users and 115 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.