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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:14:46+00:00 2026-06-18T06:14:46+00:00

Goodevening! My problem is fairly simply, my div extends beyond the screen. I have

  • 0

Goodevening!

My problem is fairly simply, my div extends beyond the screen.
I have this div:

<div id="button">Button-text</div>

My CSS looks like:

#button {
    background-color: grey;
    text-align:center;
    padding:10px;
    margin:15px;
    width:100%;
}

I could solve it with box-sizing(but that won’t work on older browsers), and it have to be responsive. Any solutions?

I also have set up a jsfiddle: http://jsfiddle.net/2k9Cd/

  • 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-18T06:14:48+00:00Added an answer on June 18, 2026 at 6:14 am

    In that case, use % for margins and padding.

    #button {
        background-color: grey;
        text-align:center;
        padding:2%;
        margin:3%;
        width:90%;
    }
    

    Here is jsfiddle

    Note: width (%) = 100% – [2 x margin(%)] – [2 x padding(%)]. In this case that is 90%=100%-2×3%-2×2%

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

Sidebar

Related Questions

Goodevening how can have a JTextArea like in netbeans (see the pic) (source: hostingpics.net
Good evening stackoverflow. I have a problem involving JOptionPanes. Every so often they simply
Goodevening everyone, I stumbled on a rather strange problem today and I have no
Good evening. I have a problem. i am using has_secure_password and cause of this
Good evening ladies and gentlemen, I have a problem with Java Swing that I
Good evening, I would like to have a navigation bar which is centralised to
Good Evening, i have a problem in running a progress bar, please check my
Good evening! I'm pretty new to Linux and Apache and I have a problem
Good evening, i hope you can help me with this problem, as I'm struggling
Good evening. I need to organize an HashMap, and it is something like this:

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.