The height of the textarea does not accommodate the content within

I've been working on developing a straightforward code editor application, but I ran into an issue with the design. The text area appears slightly taller than its container.

This is the structure of index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="index.css">
</head>
<body class="page">
    <div class="files">

    </div>
    <div class="container">
        <div class="lines">

        </div>
        <div class="editor">
            <textarea></textarea>
        </div>
    </div>
</body>
</html>

This is the CSS stylesheet for index.css:

.lines {
height: 100%;
background-color: black;
flex: 1;
display: flex;
flex-direction: column;
background-color: #34495e;
}

.editor {
height: 100%;
flex: 20;
 }

.container {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}

.page {
height: 80vh;
margin: 0;
padding: 0;
}

textarea {
width: 100%;
height: 100%;
resize: none;
border: none;
outline: none;
background-color: #2c3e50;
 }

.files {
height: 30px;
width: 100%; display: flex; flex-direction: row;
}

.file {

} 

.lines { height: 100%; background-color: black; flex: 1; display: flex; flex-direction: column; background-color: #34495e;
           .editor { height: 100%; flex: 20; } .container { width: 100%; height: 100%; display: flex; flex-direction: row;
                 flex-wrap: nowrap; } .page { height: 80vh; margin: 0; padding: 0; } textarea { width: 100%; height: 100%; resize:
                   none; border: none; outline: none; background-color: #2c3e50; } .files { height: 30px; width: 100%; display: flex;
                     flex-direction: row; } .file { } 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="index.css">
</head>
<body class="page">
    <div class="files">

    </div>
    <div class="container">
        <div class="lines">

        </div>
         <div class="editor">
            <textarea></textarea>
        </div>
     </div>
</body>
</html>

I've tried various solutions to address this issue without success. I researched on Stack Overflow, suspecting that it could be related to properties like resize, border, and outline, but they don't seem to be causing the problem.

Answer №1

Remember to include the rule box-sizing: border-box; in your textarea design

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Incorporating HTML5 audio elements in JavaScript

I am working on a project where I need to create a grid of 16 audio files with separate links for each in HTML, CSS and JavaScript. Each box in the grid should link to a different audio file. My initial thought was to use a table to achieve this, so I cre ...

Is there a way to align certain buttons to the left and others to the right within a DIV?

One of the strategies I experimented with was: <div class="block-footer"> <div> <button class="align-left">xx</button> <button class="align-right">yy</button> </div> </div> I'm ...

The presence of parentheses in a JQuery selector

My database contains divs with ids that sometimes have parentheses in them. This is causing issues with my JQuery selector. How can I resolve this problem? Let me provide an example to illustrate: https://jsfiddle.net/2uL7s3ts/1/ var element = 'hel ...

Having trouble getting smooth scrolling with easing to function properly

I'm facing an issue with a JQuery function that is supposed to enable smooth scrolling using JQuery easing, but for some reason, it's not functioning correctly and I'm unable to pinpoint the error. Here is the code for the function: $(func ...

Fix a bug in IE6 by ensuring that an element takes up 100% of the body when contained within

It appears that this issue is specific to IE6, as the code functions correctly in all other browsers. Check out the jsFiddle link with the HTML code: <div style="background:blue; width:600px; margin-left:auto; margin-right:auto;"> BLUE < ...

Utilizing the indexedDB API to display dates in the format of DD.MM.YYYY

I am working on an HTML form that collects data such as text, radio buttons, and dates. When selecting a date, it shows in the format dd.mm.yyyy. However, when checking how the date is saved in the database, I see: Object date : "2017-09-12" My question n ...

Using HTML and CSS, design a customizable tick box without explicitly utilizing the 'checkbox' element

Check out this code snippet (and yes, I'm using a basic reset.css): .checkbox { border: 1px solid black; width: 10px; height: 10px; } <ul> <li> <p><div class="checkbox"></div>I agree!</p> </li&g ...

What is the best way to incorporate the class "row" in jQuery when a bootstrap column reaches a total

In my jQuery code, I am appending images inside a div container. I need help adding a div class row when the column count reaches 12. Any suggestions would be greatly appreciated. Thank you in advance! for (var i = 0, j = result.images.length; i < j; ...

Positioning elements in relation to their parent container is key

I'm exploring the idea of positioning content after an absolutely positioned div that is nested within a relatively positioned div, without knowing the height of the relative div. Essentially, I have set up the following structure ... <div style= ...

Highlight columns and rows when hovered over in a striped table using CSS styling

I have successfully implemented a CSS-only method for highlighting table columns on hover from a tutorial I found at https://css-tricks.com/simple-css-row-column-highlighting/ However, I am encountering an issue with applying the highlight to striped tabl ...

Design a dynamic rectangular division using CSS and Bootstrap 4 that adapts to different screen sizes

I am encountering difficulties attempting to replicate a full-width rectangle div on a website, particularly with issues related to responsiveness and mobility. Here is an example of the design I am trying to recreate. And here's what I've acco ...

The process of increasing value through a function in PHP

Looking to create a function that increments a variable when a button is clicked. I have 4 buttons: farm, cave, house, casino The goal is to accumulate the random numbers generated by each button and add them up in the "YOUR GOLD" section. For example, c ...

Unable to access Bootstrap dropdown menu after initial ajax form submission

I am encountering an issue with a dropdown menu on my webpage, specifically within the manager.php file. Please excuse any formatting discrepancies as I am using Bootstrap: <!-- Bootstrap --> <script type="text/javascript" src="https://netdna ...

What is the best approach for determining which CSS file to import in next.js?

I'm currently facing the task of selecting which CSS file to apply in my next.js project. I have two separate CSS files, one for desktop and one for mobile devices. My current method of importing CSS files is as follows: // _app.tsx import ".. ...

Explore the styling options for SVG using CSS to manipulate different properties of the

After saving my SVG image in Illustrator, the code appears like this: <?xml version="1.0" encoding="utf-8"?> <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBo ...

Are there any images included in the WebResponse being downloaded?

I need to download HTML efficiently in order to parse it with minimal bandwidth consumption. Here is a snippet of my code: if (!String.IsNullOrEmpty(siteAddress)) webReq = WebRequest.Create(siteAddress) WebResponse webRes ...

When I hover over the content, the image displayed in the tooltip is causing a flickering effect

Dealing with Angular in this situation, my goal is to have an image or video displayed inside a tooltip when hovering over specific content. However, there seems to be a flickering effect before the image renders, making the transition less smooth compared ...

What are the methods for setting the width and height of an Angular mat dialog box?

I'm currently working with a Mat dialog box in Angular and I'm trying to include styles for width and height within that object. However, I'm encountering errors and can't seem to resolve them. Is there another method for setting width ...

Angular dropdown within another dropdown

I am encountering an issue with a dropdown within another dropdown on my HTML page. The structure is as follows: Dropdown |_ First Dropdown | |_ aaa | |_ bbb | |_ ccc |_ Second Dropdown |_ ddd Even though everything appears ...

Struggling with displaying and hiding div elements

Here is the code I'm currently working on: https://jsfiddle.net/Metalnoypi/d7ocf929/#&togetherjs=HD16R9BLLF I am relatively new to JavaScript, HTML, and CSS. I am facing an issue where the main menu page should disappear when the start button is ...