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

  • SEARCH
  • Home
  • 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 8311407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:48:20+00:00 2026-06-08T19:48:20+00:00

I have an area in which I want to add two buttons inside in.

  • 0

I have an area in which I want to add two buttons inside in. On the left side the button is “Sunday”, the right one is “misc”.
What I want is evenly to place two buttons.
Because two buttons have same size, so I assign them with the same class.
The code:

<div id="switcher"> 
 <div class="button" id="Sunday">Sunday</div>
 <div class="button" id="mic">mic</div>

So I thought Sunday is on the left side naturally. I just want to add some rules to seperate two buttons such as padding left…
However the result is “Sunday” is on the right side. Why?
Please see my CSS at jsfiddle.

Thanks.

  • 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-06-08T19:48:23+00:00Added an answer on June 8, 2026 at 7:48 pm

    The buttons have position set to absolute. Take this out of the .button class and ids (#Sunday and #mic).

    Additionally, I would suggest getting rid of the buttons’ margins and paddings and using display:inline-block instead of inline. You can’t specify width or height in an inline element, and block elements normally can’t render on the same horizontal line without additional fiddling.

    If you absolutely have to have the switcher width at 456px, then you can set the buttons at width 228px (1/2 of that). The line break in the html between the button divs adds a space between the buttons, so you should put the second div immediately after the first.

    Here is a more manageable version of what you were trying to do. http://jsfiddle.net/ftQD5/19/

    EDIT: If you want to align the buttons/text vertically, you can first set the buttons to position:relative and then set top:<vertical offset>px. This will shift the buttons down. Then, you can add padding-top on the buttons to make the text appear vertically centered. A newer example can be seen here: http://jsfiddle.net/ftQD5/20/

    EDIT #2: An easier way to vertically center text in a surrounding div is to make the line-height equal to the div height. This will automatically center the text. It will also be easier to work with than the padding-top since it will not affect the height of the button divs. The last updated fiddle: http://jsfiddle.net/ftQD5/26/

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

Sidebar

Related Questions

I have an area in which I want to add two buttons inside in.
I have a text area (from which I take a number) and button to
I have created one plugin which i want to display at the bottom of
I have a View which I want to have a label and 2 buttons
I have an area which is represented by constrained delaunay triangulations. I am playing
I have a header area which is divided up into block areas for images,
I have a text area page which is launched from the previous page: $message
I have a text area on which I would like to listen to change
Does JavaFX 2.0 supports printing? I have a text area from which I take
I have web-service which give list of property at a particular area My problem

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.