I have a style:

.title1
{
color: #0000BB;
font-size: 25pt; 
text-align: center;
}

but when I use it with:

<span class="title1">Schenectady Section of the IEEE  More Words</span>

it doesn't center the text!

You can see this behavior here:
http://ewh.ieee.org/r1/schenectady/New/

Surely I am just doing something silly...

Thanks!

David

Recommended Answers

Hi David,

Use a p or div rather than a span. Text is an inline element and so is a span. For text-align to work, it must be used on a block level element (p, div, etc.) to center the inline content.


Regards, Arkinder

Jump to Post

All 2 Replies

Hi David,

Use a p or div rather than a span. Text is an inline element and so is a span. For text-align to work, it must be used on a block level element (p, div, etc.) to center the inline content.


Regards, Arkinder

Works like a charm, thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.