Link to home
Start Free TrialLog in
Avatar of isnoend2001
isnoend2001Flag for United States of America

asked on

Adding a text align to a font class in css

Every where I use this font tag:it is centered. So i changed the css from this:

.BfontWhite12 { font-size: 12px; font-family: verdana, arial, helvetica, sans-serif; color: #FFFFFF; font-weight: bold;}
To this:
.BfontWhite12 { font-size: 12px; font-family: verdana, arial, helvetica, sans-serif; color: #FFFFFF; font-weight: bold; text-align:center; }
would this be correct ?
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of isnoend2001

ASKER

Good thanks for fast help
You can see the results here http://jsbin.com/alihoc/1/edit
The span will not center because it is not a block level element like div or p.  To center a span you have to add, "display:block" to the css like this,  span{display:block;}
Thanks i am glad you added that. I have had trouble with span in the past and never knew
why. so adding  span{display:block;} makes it act as block level ?
Right.  But typically you would use span to create special  formats within other formats.  
http://jsbin.com/ebezam/1/edit
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>test</title>
  <style>
  p{font-size:18px;}
    .first_letter{font-size:24px;color:Red;} 
  </style>
</head>
<body>
  <p><span class="first_letter">O</span>nce Upon A Time....</p>
</body>
</html>

Open in new window