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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:08:05+00:00 2026-06-17T01:08:05+00:00

I am trying to set up a custom toolbar for a textarea, I have

  • 0

I am trying to set up a custom toolbar for a textarea, I have the following

html:

<div id="main">
  <div id="toolbar"></div>
  <textarea></textarea>
</div>

css:

#main {
  background-color: #ddd;
  height: 400px;
  width: 400px;
  position: relative;
}

#toolbar {
  background-color: #444;
  height: 40px;
  color: white;
}

textarea {
  outline: none; 
  border: none;
  border-left: 1px solid #777;
  border-right: 1px solid #777;
  border-bottom: 1px solid #777;
  margin: 0;
  position: absolute;
  top: 40px;
  bottom: 0;
  left: 0;
  right: 0;
}

It works exactly as I expected in Chrome, but in firefox / ie the text area is not consuming all the available space in the div.

How do I set it up so the toolbar takes up 40px at the top of the div, and the textarea consumes all the rest of the height.

I am sizing this stuff dynamically so can not use a “px” height or width for the textarea.

Codepen here: http://codepen.io/anon/pen/pDgvq

  • 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-17T01:08:06+00:00Added an answer on June 17, 2026 at 1:08 am

    Better Suggestion

    Set the textarea’s width and height to 100%. Then, give it a 40px top-border that is transparent (color doesn’t really matter, actually). Be sure to set box-sizing to border-box. Now position the relative toolbar on a higher z-index – voila.

    Pen: http://codepen.io/anon/pen/nFfam

    Oldie

    Rather than moving the textarea down, move the toolbar up:

    #main {
      background-color: #ddd;
      height: 200px; width: 400px;
      position: relative;
      top: 40px;
    }
    
    #toolbar {
      background-color: #444;
      height: 40px; width: 100%;
      position: absolute;
      top: -40px;
    }
    
    textarea {
      width: 100%; height: 100%;
      box-sizing: border-box;
    }
    

    Pen: http://codepen.io/anon/pen/mEGyp

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

Sidebar

Related Questions

I am trying to set a custom background image on my tabbar. I have
I've been trying to set up a custom background for the whole of my
I am trying to set custom error messages for invalid length of the following
I have been trying to set a custom resourceProviderFactory at the web.config file but
I'm using ActionBarSherlock and I'm trying to set a custom background on the action
I am trying to set up a custom entity in Magento 1.7.0.0, following alan
I'm trying to set custom SVG icons with CSS on a <ul> 's list
I'm trying to set a custom background image for a UITableViewCellAccessory. Is this possible?
I'm trying to set color of TextView in custom arrayadapter, but it does'nt work
I am trying to set an image as the background of a custom UIButton.

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.