What is the best way to include a secondary border to a responsive textarea?

Currently, I am utilizing Twitter Bootstrap 3.2.0 and below is the code snippet:

Click here for jsFiddle

.textarea textarea {
  background-color: white;
  background-image: url("http://ello.96.lt/images/as.jpg");
  line-height: 1.56em;
  padding-left: 4.2em;
  padding-right: 0.3em;
  border: solid 1px #525252;
}
<div class="col-lg-8 col-md-8 col-xs-12">
  <!-- Name input-->
  <div class="col-lg-10 col-lg-offset-1 col-md-10 col-xs-8 textarea">
    <div class="form-group float-label-control">
      <label for="" style="font-size: 2em;">Please leave some of yours contact details below</label>
      <textarea id="email_comment" class="form-control" style="color: #424242 !important;" placeholder="Press here with mouse to edit and start writing a letter for me" rows="14"></textarea>
    </div>
  </div>
  <!-- Form actions -->
  <div class="col-lg-12 col-md-12 col-xs-12 form-group submit">
    <button id="submit" type="button" class="btn btn-sunny text-uppercase btn-lg">Send</button>
  </div>
</div>

I am aiming to achieve the styling demonstrated in this example:

Link to desired styling on jsFiddle

Tutorial on creating notebook-like styling for textarea

I am trying to add double borders on the left and bottom of my textarea but haven't had success despite multiple attempts.

Answer №1

I have enclosed your textarea within a wrapper element and utilized a pseudo element to create a narrower border at the bottom.

.textarea textarea {
  background-color: white;
  background-image: url("http://ello.96.lt/images/as.jpg");
  line-height: 1.56em;
  padding-left: 4.2em;
  padding-right: 0.3em;
  border: solid 1px #525252;
}
.jbutler483 {
  position: relative;
  display: inline-block;
}
.jbutler483:before {
  content: "";
  position: absolute;
  bottom: -1px;
  right: 1px;
  width: 100%;
  background-image: url("http://ello.96.lt/images/as.jpg");
  height: calc(100% - 4px);
  z-index: -1;
  border: 2px solid gray;
}
<div class="col-lg-8 col-md-8 col-xs-12">
  <!-- Name input-->
  <div class="col-lg-10 col-lg-offset-1 col-md-10 col-xs-8 textarea">
    <div class="form-group float-label-control">
      <label for="" style="font-size: 2em;">Kindly provide your contact details below</label>
      <div class="jbutler483">
        <textarea id="email_comment" class="form-control" style="color: #424242 !important;" placeholder="Click here to start writing a message for me" rows="14"></textarea>
      </div>
    </div>
  </div>
  <!-- Form actions -->
  <div class="col-lg-12 col-md-12 col-xs-12 form-group submit">
    <button id="submit" type="button" class="btn btn-sunny text-uppercase btn-lg">Send</button>
  </div>
</div>

Answer №2

.textbox {
position: relative;
}
.textbox:after{
    content:''; 
    position:absolute; 
    width: 100%; 
    bottom: 10px; 
    left: 0; 
    border-bottom: 1px solid #F8D3D3;
}

To create a red border below the textbox, apply your :before and :after styles to a block element (such as a div) instead of directly on the textbox itself. It may be helpful to wrap the textbox in a div with width set to auto so that the border will scale along with the size of the textbox, rather than the containing .textbox div which also includes the label.

Answer №3

To make this design stand out, simply apply the following CSS:

.textarea textarea {
    background-color: white;
    background-image: url("http://ello.96.lt/images/as.jpg");
    line-height: 200%;
    padding-left: 75px;
    padding-right: 0.3em;
    border: solid 1px #525252;
}

View the DEMO Here

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

Footer void of color

It's puzzling to me where the extra space in my footer is coming from. It seems to be around 20-30px as you can see on the following url: Despite the code in my footer being minimal, with no apparent cause for this additional space below my social ic ...

JavaScript drag functionality is jerky on iPads, not seamless

I am currently attempting to implement a feature where I can drag a div (#drag) within its parent container (#container) using only pure JavaScript. This functionality is specifically required to work on iPad devices only. After writing a script that func ...

How can you insert text onto a page with restricted space?

As I work on my web page, I find myself restricted by a character limit of 10,000. This limitation is proving to be quite challenging for me. The tabs on the page I am editing are divided with div ID, and all my writing already takes up 80% of the charact ...

initiate changes to the application's style from a component nested within the app

I'm looking to update the background color of the entire page, including the app-nav-bar, when I'm inside a child component. When I navigate away from that component, I want the default style to be restored. Any suggestions on how to achieve this ...

Preventing responsive elements from loading with HTML scripts

Currently, I am utilizing the Gumby framework which can be found here. Everything appears to be running smoothly. My goal is to incorporate a mobile navigation list where the links are grouped under a single button, as outlined here. Initially, this funct ...

The node.js and express.js update operation (CRUD) is not rendering the CSS files properly

I am currently developing a CRUD app using Node.js/Express.js with EJS as the templating engine. The concept I'm working on involves displaying user_ids from a database, and when an admin clicks on a user_id, it should redirect them to the edit_team. ...

Having a solid grasp of React and Material UI, as well as familiarity with the concept of props and

For my react application, I utilize Material UI (@mui/material). However, I've come to realize that there might be some nuances in how the components interact with each other. For instance, if I nest a MenuItem inside a Box or a Link inside a Typograp ...

Developing a feature that allows users to switch between different sets of information

I'm currently exploring a new project and attempting to design a toggle that switches between monthly and annual payments based on the user's selection, much like the functionality found here: . At present, I have implemented two sets of price c ...

Why isn't my .gif animation appearing on Google Chrome? Can anyone suggest a reason for this issue?

const urlToLoad = "winners.php"; const ajaxLoader = '<div class="preloaders"><img src="img/preloader.gif" alt="Loading..."></div>'; $(".page").click(function(){ $(".main").html(ajaxLoader).load(urlToLoad); }); I am trying ...

creating a multi-tiered dropdown menu using both CSS and JavaScript

I am in need of a multi-level (drop down) menu feature, that allows me to make changes to the menu in just one file, without having to navigate through each individual page. I require a three level menu. I have attempted to modify someone else's code ...

The background image fails to show up on the mobile device display

Currently, I am working on an app with Ionic, but unfortunately, the background image is not showing despite all my efforts. I have gone through various solutions provided in previous questions, but none of them seem to work for me. Here is the CSS I am u ...

Return to the main page by clicking on the link #id

I am in the process of creating a personalized Wordpress theme that consists of one main page with 8 additional sub-pages. I am wondering how I can navigate to a specific section using an ID (for example, <a href="#how">how</a>) from the sub-pa ...

What is the best way to incorporate CSS into JavaScript code?

Here is the code I am working with: <script type = "text/javascript"> function pic1() { document.getElementById("img").src = "../images/images/1.png"; } function pic2() { document.getEl ...

Bootstrap Dropdown Functionality Malfunctioning

Here is a simple piece of HTML code that I have created: <!doctype html> <html> <head> <meta charset="utf-8"> <title>.:Home Page:. The Indian Sentinel</title> <link rel="stylesheet" href=" ...

Using JQuery functions from other JavaScript files is Simple

When it comes to my CSS, I have taken the approach of creating smaller files for specific functions and then using minification to merge and compress them into one file for easier download. I want to apply the same strategy to my JS Files by logically sep ...

Achieving Vertical Alignment of Text and Icon in the Same Line Using HTML and CSS

I am struggling to align these icons vertically center with the text. However, there seems to be a slight offset of a few pixels. I have experimented with different solutions, but this is the closest I could get to. Can anyone explain why it's not ali ...

Combining multiple PNG images onto a base image in PHP

I need assistance in merging 24 images with single dashes highlighted into a base circle image using PHP GD, JS or CSS. All images are in PNG format. Your help would be greatly appreciated. ...

What is preventing these elements from being contained within particular divs?

I'm facing an issue with my HTML code and need some help unraveling what's happening. On my simple website, I have a container div, header div, and body div, but it seems like the HTML elements are not aligning properly within these divs (they a ...

What steps can I take to stop my html table from expanding beyond its intended size

There are instances where the length of a data piece in one of my table cells causes it to expand and distort the overall layout of the table. Is there a way to avoid this from happening? ...

clicking on links to different sections of the page does not automatically bring you to the top of

I am working on a design similar to this: http://jsfiddle.net/MTWu5/ The layout consists of a centered page with a sticky header. The header contains menu links that lead to anchors within the page. My issue arises when clicking on these links - I would l ...