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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:58:17+00:00 2026-06-17T19:58:17+00:00

I am a CSS beginner. I want a half transparent centered div with the

  • 0

I am a CSS beginner.
I want a half transparent centered div with the main content. Below it should be a fixed div containing the table of contents.

Below is my attempt on this. This works with a certain browser size. But when the size of the browser window changes, the table of content moves.

I want the table of contents to stay at a fixed distance to the main div.

jsFiddle link

With this window size everything looks ok:
with this window size everything looks ok

Decreasing the window size moves toc under content div:
decreasing the window size moves toc under content div

html

<html>
<head>
    <title>Testpage</title>
    <link rel='stylesheet' href='css/testpage.css'>
</head>
<body>
    <div id="contenttable">
        <h1>Contents</h1>
        <a href="#">Content 01</a><br>
    </div>
    <div id="content">  
        some text
    </div>
</body>
</html>

css:

#content{
    height: 1000px;
    width:  320px;
    position: relative;
    top: 50px;
    left: 50%;
    margin-left: -160px;
    background-color: cyan;
        }

#contenttable{
    padding: 12px;
    width:100%;
    height:200px;
    position: fixed;
    background-color: yellow;
    top: 125px;
    left: 6%;
}

#contenttable a{
    position: relative;
    top: 0px;
    left: 66%;
}

#contenttable h1{

    position: relative;
    top: 0px;
    left: 66%;
}
  • 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-17T19:58:19+00:00Added an answer on June 17, 2026 at 7:58 pm

    You can use an inner div absolutely positioned inside the fixed TOC, and set its position.

    Use CSS3 Calc to elaborate the right position for your main content.

    Use opacity for transparency, and avoid setting the height of the main content div for automatic overflow handing.

    Demo: http://jsfiddle.net/vMAQz/1/

    CSS

    #contenttable {
      padding: 12px;
      width:100%;
      height:200px;
      position: fixed;
      background-color: yellow;
      top: 125px;
    }
    #innerContent {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      width: 100px;
      padding: 30px;
    }
    #content {
      padding: 10px;
      opacity: 0.8;
      width: 320px;
      position: relative;
      top: 50px;
      left: calc(100% - 480px);
      background-color: cyan;
    }
    

    HTML

    <div id="contenttable">
      <div id="innerContent">
        <h1>Contents</h1>
        <a href="#">Content 01</a>
        <br/>
      </div>
    </div>
    <div id="content">
       some text
    </div>      
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a div with a fixed width image on the left and a
I'm a beginner to CSS, and i want to know the best technique to
I am a WordPress beginner. I want to insert css code into an article
Im a beginner to css, please can someone help me get this element to
I believe this is a beginner's CSS question. I am utilizing the method described
I am a beginner at HTML and CSS. the text on my page keeps
CSS table tr {border-bottom:1px solid #008999} HTML <table width=100% cellspacing=0 cellpadding=0> <thead> <tr> <th
Here's my background: Decent experience with PHP/MySql. Beginner's experience with OOP Why I want
I plan to start web app development. (Html, Css and Php) I want to
First of all I want everyone to know that I am absolute beginner so

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.