CSS problem

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

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
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2194
  • Loc: Canada

Post 3+ Months Ago

CSS Code: [ Select ]
font-weight: bold;
 
  1. font-weight: bold;
  2.  
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

The bold thing works, but it doesn't center...
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2194
  • Loc: Canada

Post 3+ Months Ago

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

?
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

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 :)
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6250
  • Loc: Seattle, WA

Post 3+ Months Ago

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.
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2194
  • Loc: Canada

Post 3+ Months Ago

margin: 0 is the same as margin: 0 0 0 0 as well ;)
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

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:
  • nardar
  • Newbie
  • Newbie
  • nardar
  • Posts: 5

Post 3+ Months Ago

Tell me about the difference between margin and padding
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2194
  • Loc: Canada

Post 3+ Months Ago

Check out this display of the box model.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

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).
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2194
  • Loc: Canada

Post 3+ Months Ago

If you ever can't get something to look right, you may want to read up on collapsing margins as well.
  • nardar
  • Newbie
  • Newbie
  • nardar
  • Posts: 5

Post 3+ Months Ago

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: ScottG and 65 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.