Avatar of isnoend2001
isnoend2001
Flag 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 ?
CSS

Avatar of undefined
Last Comment
Scott Fell

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Scott Fell

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
isnoend2001

ASKER
Good thanks for fast help
Scott Fell

You can see the results here http://jsbin.com/alihoc/1/edit
Scott Fell

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;}
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
isnoend2001

ASKER
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 ?
Scott Fell

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