Vertically Align Span Inside Right Floated Div

Hi there,

I have a DIV that is 40px high and 100% wide.
Inside that DIV I have a DIV that is floated to the right.
Inside the floated DIV I have a SPAN (generated by ASP.NET) with text in it.

I need to have the SPAN vertically aligned inside the floated DIV.

For the life of me, I cannot figure out how to do it. I really need an experts help!

Thanks!
LVL 6
hehdaddyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hehdaddyAuthor Commented:
I forgot to mention that I am using IE7/8.
0
Sebastian TalmonSystem Engineer Datacenter SolutionsCommented:

Do you need to align only the <span> (is there other text that should not get aligned), or is it ok if you get anything in your floated <div> aligned?

if only the <span> should be aligned, you have to make it a block element (<span> is normally an inline-element) before you could align the text in it:
span.xxxx { display:block; width:100%; text-align:center; }

if you could use the floated div, try something like
div.xxxx  { text-align:center; }
0
hehdaddyAuthor Commented:
@tacotec - I need to align the SPAN vertically (up and down). Does your solution do that?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Sebastian TalmonSystem Engineer Datacenter SolutionsCommented:

args - vertically (sorry, my mistake)

is the span the only content in the div?

could you maybe give some short sample of the html-code?
0
Blind-SummitCommented:
div {
height:40px;
}
div div {
height:40px;
}
div div * {
vertical-align:middle;
}
div div span {
display:block;
}
0
Blind-SummitCommented:
Ignore that, just set the span line-height to 40px.


span {
   line-height: 40px;
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.