CSS can be used to remove all borders except for the bottom one

I have successfully removed all borders on my text input field except for the bottom. However, once I begin typing in the field, the border reappears. How can I resolve this issue?

input {
  margin-top: 10px;
  width: 25%;
  height: 39px;
  border: 2px solid rgba(137, 43, 226, 0.562);
  border-top: 0;
  border-right: 0;
  border-left: 0;
}
<input type="email" placeholder='Enter email' required /> <br />
<input type="password" placeholder='Enter password' required /> <br />

Answer №1

When you first click into the input field, what appears around it is not the border but the outline. To avoid this, make the necessary adjustment as shown below:

input {
  margin-top: 10px;
  width: 25%;
  height: 39px;
  border: 2px solid rgba(137, 43, 226, 0.562);
  border-top: 0;
  border-right: 0;
  border-left: 0;
  /* Added */
  outline: none;
}
<input type="email" placeholder='Enter email' required /> <br />
<input type="password" placeholder='Enter password' required /> <br />

Answer №2

Perhaps consider adjusting the border when focused:

input:focus {
    margin-top: 10px;
    width: 25%;
    height: 39px;
    border: 0;
    border-bottom: 2px solid rgba(137, 43, 226, 0.562);

}

Answer №3

To achieve the desired result, you should include the following CSS code in your stylesheet:

    input,
    input:focus,
    textarea:focus,
    select:focus {
       margin-top: 15px;
       width: 30%;
       height: 45px;
       border: 3px solid rgba(255, 99, 71, 0.75);
       border-top: 1px;
       border-right: 1px;
       border-left: 1px;
       outline: none;
    }

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

Are cookies always included in client requests?

With every interaction between the server and browser, cookies are exchanged back and forth. However, what happens when an image is requested? <img src='myPic.jpg' /> Is the browser also sending cookies during this type of request? If i ...

What is the best way to dynamically implement text ellipsis using CSS in conjunction with Angular 7?

i need to display a list of cards in a component, each card has a description coming from the server. In my component.html, I am using a ngFor like this: <div [style.background-image]="'url('+row.companyId?.coverUrl+')'" class="img- ...

Why is Bootstrap 4 causing these columns to stack vertically instead of horizontally?

After upgrading to bootstrap 4, I noticed that my gallery layout has changed from horizontal in bootstrap 3 to vertical. What could have caused this sudden change? To see the issue, here is a link to a fiddle. Here are my column settings: <div class= ...

Position the icon to the left within a bootstrap 5 card

Struggling with alignment in Bootstrap 5, facing two issues: 1- How to align my icon with the left border of the card body? 2- Increasing the icon size affects the vertical alignment of my card item (see image below) https://i.sstatic.net/dR7DD.png Try ...

creating PHP buttons to update inventory

As a newcomer to AJAX and PHP, I am facing some challenges with an inventory management system built using phpmyadmin and wamp. The registration/login system is functioning well. However, upon user login, a table displaying all inventory items is generated ...

What happens when HTML5 Video quality starts to decline?

Exploring the capabilities of the HTML5 video tag has left me pondering the best approach for graceful degradation in cases where a codec is not supported. Handling older browsers (or IE) that lack support for the video tag altogether is quite straightfor ...

The Div element containing the rollover button/picture is failing to resize properly as the window is decreased in size

Whenever I try to resize my browser window in Firefox or Chrome, the div ends up moving instead of resizing. I've searched on stackoverflow for answers but haven't found any solutions yet. Can someone please help me with this issue? Here is what ...

Give a CSS Element a specific class

Can all h3 elements be styled with the class responsive-heading using only CSS? Take a look at the CSS snippet provided for more clarity: h3 { .responsive-heading } /* The responsive-heading class is defined in another CSS file and includes: .respons ...

When the header is given a fixed position, the modal becomes unattainable

I am currently working on developing my personal news website called News Pews. This is my third project, and I have encountered an issue that was not present in my previous projects. The problem arises when I apply position: fixed; top:0; to the header c ...

Using `ngRepeat` on a different array of values for repetition

Working with AngularJS. Here is an example of a JSON object: "skills": { "Charisma": {}, "Dexterity": { "Sk3": [ [ true, true, true, true, false ], 44 ] }, ... And the corresponding HTML: <div class="pan ...

Guide: "Changing an HTML element's class by utilizing its id attribute"

This is the HTML code snippet I am working with: <li class="treeview" id="account_management"> I need to select the element with the id of "account_management" and update its class from "treeview" to "treeview active" in order to ...

Binding event listeners to dynamically created elements poses a challenge

I am facing difficulty in adding an event listener to dynamically created elements. The issue lies in my code where I am unable to detect the insertion of <p> element resulting in the lack of console message Bar Inserted. Could you point out if there ...

Utilizing CSS and HTML exclusively, display content on hover

Is there a way to display a child div when hovering over an anchor tag? I'm looking to reveal a div with the class of botm when the cursor hovers over the anchor tag. Here's the specific layout I have in mind, so please maintain the order of tags ...

Sticky Bootstrap Navbar

I am trying to incorporate a Bootstrap 4 navbar into a div with a background image. My goal is for the navbar to become sticky at the top, resize, and change color as the user scrolls down the page. However, I've noticed that when I place the navbar w ...

Steps to display a JSX component stored in a variable

Presently, I am implementing an if/else statement within my code to determine the content that will be displayed in the JSX element named 'signupMessage'. Subsequently, I render the contents of this 'signupMessage' element. render() { ...

What is the best way to retrieve the previously chosen item from an array?

I have successfully implemented dynamic pill tabs with one minor issue remaining. The most crucial aspect is that when I remove a pill, I want it to return to the previously opened tab. I have provided a StackBlitz example without routes on this page: -> ...

Achieving a perfectly centered alignment of two divs in Bootstrap 5 can be accomplished by placing one div with an input field next to another div

I am trying to center an input and a button on the same line within a div in the middle of the page. Currently, as shown in the image, they are aligned to the left of the page and I want them to be centralized. https://i.sstatic.net/o3RLs.png <div cla ...

Discovering an <a> element with an href attribute containing two specified strings

Here's what I have: $("a[href*='string1' && 'string2']") Unfortunately, this code didn't work for me. I also attempted: $("a:contains('string1' && 'string2')") The second one only return ...

Steps for creating a square button

Is it possible to create a square button on my website that still functions like a traditional button? I want the button to change appearance slightly when scrolled over. Currently, I have an example where the button is not clickable: http://jsfiddle.net ...

Understanding how to incorporate a URL parameter using HTML and Javascript

I have a web application section where users can search for locations on a map successfully. However, I'd like the text of the location to be displayed in the URL so that users can easily copy and share it for consistent searches. What is the most ef ...