Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6887191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:51:17+00:00 2026-05-27T05:51:17+00:00

I have a Span tag containing a IMG tag and another Span tag. I

  • 0

I have a Span tag containing a IMG tag and another Span tag.
I would like the inner Span tag to be aligned to the left and the IMG tag to be centrally aligned plus I want both the tags to be vertically aligned in the middle, and I can’t seem to get this right…

This is how it looks (It’s blue because the outer Span tag is marked in FireBug to show that it’s stretching the entire surface):

enter image description here

As you can see in the image, both tags are centred and they are also aligned in the top of the container, I don’t want either of this.

This is the markup:

enter image description here

This is the current CSS of the tags:

.v-button-wrap {
    height: 100%;
    display: block;
    padding: 6px 15px 0 9px;
    vertical-align: middle;
    line-height: normal;
    text-align: center;
}

.v-icon {
    margin-left: auto;
    margin-right: auto;
    vertical-align: middle;
    line-height: normal;
    text-align: center;
}

.v-button-caption {
    text-align: left;
    line-height: normal;
    vertical-align: middle;
}

I left out the CSS that isn’t relevant for my problem, colors, font-specs and such. Needless to say I’m no ace at CSS. And I’ve looked up several guides covering the problem, but I’ve only managed to find examples where the entire content of a div is centered, and that’s not what I want.

Does anyone with good CSS knowledge see the problem in my code? Or have another solution to solve my problem..?

Thanks!

EDIT: Here’s a screen shot of the entire layout due to request. Sorry I have to blur some things… but they are in either case not important. =)

enter image description here

EDIT2: I did manage to solve my problem using the following CSS:

.v-button-details-panel-header .v-button-wrap {
    height: 100%;
    text-align: inherit;
    padding: 0px;
}

.v-button-details-panel-header .v-button-wrap .v-button-caption {
    display: table-cell;
    position: relative;
    text-align: left;
}

.v-button-details-panel-header .v-button-wrap .v-icon {
    display: table-cell;
    position: relative;
    top: 12px;
    margin-left: auto;
    margin-right: auto;
}

I’m sure the advice dgvid proposed would have been good for a static layout. But since the panels and horizontally stretched buttons move depending on expansion and collapsing that wasn’t a fitting solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:51:17+00:00Added an answer on May 27, 2026 at 5:51 am

    You might need to set the CSS display property of both your img and span.v_button_caption to inline-block.

    See also this article: Understanding vertical-align, or “How (Not) To Vertically Center Content”

    As for another technique to achieve the desired result: If you know the height of the container element and you know the height of the element to be centered (and unfortunately from the CSS you’ve posted, it does not appear that you do), then you could

    1. Give the container element CSS property `position: relative’
    2. Give the element-to-be-centered CSS property position: absolute
    3. Set the CSS top property of the element-to-be-centered to (containerHeight / 2) – (centeredEltHeight / 2).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The vote buttons just have an img tag, span tag, and another img tag.
a I have some images on page and I want to put <span> tag
I have two span elements that I would like to stay on the same
So i have a pre tag like so: <pre> Some content, more content. <span>Coloured
I have a div containing an event I want it to look like this
I have a div and span tag. Something like: <div>Test <span class=link-action><a href=url>Link text</a></span></div>
If I have a span tag like this: <span>Hi<br />SecondLine</span> And I call this
I have the following html code: <h3 id=headerid><span onclick=expandCollapse('headerid')>&uArr;</span>Header title</h3> I would like to
Is it ok to have a span tag within another span tag? I need
I have a span with 2 classes, like this <span class=tag invalid_tag>abc</span> . I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.