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 7564641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:57:10+00:00 2026-05-30T13:57:10+00:00

This fiddle demonstrates the problem. I’m trying to align an image and a button

  • 0

This fiddle demonstrates the problem.

enter image description here

I’m trying to align an image and a button to the right, on two separate lines, as a joint unit. I created a wrapper div (“right-stuff”), with position:relative, so I can use position:absolute on its child, the button.

The problem is I don’t know of a good way to align the button to the right without hurting the height calculations.

What I did is give it position:absolute and right:0, but this removes it from the flow, and causes the container (“right-stuff”) not to include it – see how the red background doesn’t reach it, although it “should”.

Another problem is that the next item in the flow after “right-stuff” will need a margin-top to be in the correct position, or otherwise I have to either give “right-stuff” a width I calculate myself, or an artifical margin (that takes into account the button height). Too much knowledge here.

Is there a better way to get both items to act as a coherent unit, that is “right aligned”, but without taking things out of the flow?

Obviously this is not the first time someone has asked this question, but I haven’t found an answer here that addresses these specific concerns without ugly hacks (like manually adding a margin-bottom equal to the button’s height).

Edit: text-align is a decent solution (better than what I thought of anyway). One caveat: It assumes the button is indeed textual, and doesn’t work on the image itself. This is ok in my example because the image is the widest thing in the container – but what if I had another element in the container that was wider than the image? How would I keep the image aligned to the right?

  • 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-30T13:57:11+00:00Added an answer on May 30, 2026 at 1:57 pm

    Yes, since both of those elements (img and button) are inline-block you can simply use text-align: right.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written this fiddle to demo the problem. I have a simple form. When
In this fiddle i have a part of my form: http://jsfiddle.net/ZXSKH/55/ I am trying
in this fiddle, http://jsfiddle.net/urfXq/79/ , if you click on the black button, it randomly
Two questions about this fiddle. http://jsfiddle.net/mjmitche/4emqh/2/ 1) Originally, the black box (with div id
I have this fiddle: http://jsfiddle.net/y8Uju/5/ I am trying to save the numbers, because, when
I created this fiddle so that you can see what i am trying to
In this fiddle http://jsfiddle.net/SySRb/40/ , I created an array with two elements, #f-ONE and
In this fiddle http://jsfiddle.net/5L8Q8/28/ , if you click the black button, it randomly selects
I made this fiddle to show my problem. I have a list and I
I made this fiddle to demonstrate the problem. Table margins don't collapse in Firefox,

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.