Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
Static header on a webpage without zoom/scroll

This is what I'm trying to accomplish:

+--------screen-----------------------+
|       ______________________      |*|
|       |___static_header____|      |*|
|       |                    |      |*|
|       |      content       |      |*|
|       |     scrollable     |      |*|
|       |      zoomable      |      |*|
|       |                    |      |*|
|       |                    |      |*|
+-------------------------------------+

The content is variable height, and I would like it to be zoomable and scrollable. The header should be static with fixed size ignoring the client's zoom level. I'm not sure I have seen this done before. My current code below still isn't right for scrolling: the scrollbar goes all the way up to the header and I would like it to stop at the edges of content both for zooming and for scrolling. Is this doable without using an iframe for the content section? It doesn't need to be CSS-only

body {
    padding: 0;  
}
.wrapper {
    margin:0 auto;
    width: 1000px;
}
.static {     
    width:1000px;
    z-index:2;
    height:100px;
    position: fixed;   
}
.header {
    background-color: silver;
    height:100px;
}
.content {
    background-color: orange;
    width:800px;
    height:500px;
    float: left;
    position:relative;
    top: 100px;
}
<div class="wrapper">
    <div class="static">
        <div class="header">
            Header
        </div>   
    </div>
    <div class="content">
        Content
    </div>
</div>

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You need to have a height on the parent, in this case the body for overflow: hidden; to work as expected. Then you can set the heights on the other elements, just ensure they don't exceed the 100% so there is no body overflow. See the changes below.

body,
html {
  padding: 0;
  height: 100%;
  overflow: hidden;
}

.wrapper {
  margin: 0 auto;
  width: 90%;
  height: 100%;
}

.static {
  width: 100%;
  z-index: 2;
  position: sticky;
  overflow: hidden;
}

.header {
  background-color: silver;
  height: 100px;
}

.content {
  background-color: orange;
  width: 80%;
  height: 95%;
  overflow-y: scroll;
  position: relative;
}

.content-wrapper {
  height: 2000px;
}
<div class="wrapper">
  <div class="static">
    <div class="header">
      Header
    </div>
  </div>
  <div class="content">scroll this content only
    <div class="content-wrapper"></div>
  </div>
</div>

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!