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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:22:54+00:00 2026-06-13T08:22:54+00:00

I have following code: <div style=border:4px solid black;width:100%;height:100px;position:fixed;left:250px;> out of bound :( </div> I

  • 0

I have following code:

<div style="border:4px solid black;width:100%;height:100px;position:fixed;left:250px;">
out of bound :(
</div>

I want it not to cross the window. I need its right border to stay visible.

JSFiddle link: http://jsfiddle.net/9SZAB/

  • 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-13T08:22:55+00:00Added an answer on June 13, 2026 at 8:22 am

    Remove the width property and instead use right: 0:

    div {
        border:4px solid black;
        height:100px;
        position:fixed;
        left:250px;
        right: 0;
    }
    

    Updated fiddle: http://jsfiddle.net/9SZAB/2/

    Why this works: position: fixed tells the element to have a fixed position relative to the viewport, so that the positioning properties left, right, top, and bottom, as well as width and height will position and size the element based on the size and boundaries of the viewport.

    Previously you had width: 100%, which, combined with position: fixed, means that the element’s width should be 100% of the viewport’s width. This width is not and should not be affected by any margins or positioning that you also set – the element will still have 100% of the viewport’s width, no matter where it is.

    But if the element has a width value of auto (which is default), then the positioning properties can be used to size it. Just as left: 250px means that the left side of the element should be 250px away from the viewport’s left boundary, right: 0 means that its right side should be 0 (px, em, parsecs – unit doesn’t matter for a value of 0) away from the vp’s right boundary. Resize the viewport and this state will still be true.

    more info: http://css-tricks.com/absolute-relative-fixed-positioining-how-do-they-differ/

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

Sidebar

Related Questions

I have the following html code: <html> <body> <style> div{border:solid 1px;} .cool{width:400px;height:102px; overflow:auto;} .cool
I have the following code: CSS #main { width:100%; height:120px; border:solid 1px #efefef; }
I have something like the following code: <div style=border:2px black solid;overflow:hidden;> <span style=float:right;> <img
i have following block of the code on my page <div style=width:100%; >//div0 <div
I have the following html code with Jquery Sorting <div class=sortable style='width:700px; margin: 0
The following is a 3 x 3 table: <html> <body style=overflow:hidden;> <style> div.table_div {overflow:scroll;width:378px;height:117px;position:relative;}
I have the following css code: #Layer3 { position:absolute; width: 89%; height: 40%; left:
I have the following code: <HTML> <head> <style>div{border:dashed 1px silver}</style> </head> <BODY style=background: #fff;>
I have the following code: <div style= class=skiptranslate> <iframe frameborder=0 style=visibility:visible src=javascript:'' class=goog-te-banner-frame skiptranslate
i have the following code <div class=hitarea expandable-hitarea></div> <span class=folder>level 1</span> <ul style=display: none;>

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.