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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:24:20+00:00 2026-06-17T06:24:20+00:00

How can I set the width property of a div so that it is

  • 0

How can I set the width property of a div so that it is always a percentage of the browser window’s width?

For example,

  • when the width of the browser window is 1920px, the div‘s width is 1536px (80%)
  • when the width of the browser window is 1600px, the div‘s width is 1280px (80%)

and so forth?

  • 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-17T06:24:21+00:00Added an answer on June 17, 2026 at 6:24 am

    You should use a wrapper div and set it equal to 100% of the browser width, then put the desired div and set it to width:80%. This will allow you to center your desired div too. (use margin:0 auto for this.)

    Here’s a JSFiddle with a demo: http://jsfiddle.net/6Lwpr/

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

Sidebar

Related Questions

Suppose I have a div in my page, that doesn't have a width property
I have a content div that loads different pages. I can't set fixed position
I can set the width and height of my canvas by setting the width
How can I set the width of an asp:chart to be 100% the width
How can the width of the textbox rendered by the @FileUpload helper be set?
I have a select dropdown menu that has a fixed width with a percentage.
With mx:Box I can set the direction to be either horizontal or vertical. I'd
With jQuery UI you can set icons from the framework on button, i want
I know I can set a CultureInfo object with an specified culture in the
Normally with Java Swing you can set the background color of a button with:

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.