CSS Pseudo Focus may not be effective on all elements

My website has three contact fields, and I want them to have a thicker border when selected. I attempted to use "field:focus"... but now I'm facing the issue that it only works for one of the three fields.

.contactForm {
  background-color: rgb(118, 143, 197);
  padding-top: 60px;
  padding-bottom: 140px;
}

.contactForm p {
  color: rgb(255, 255, 255);
  margin-bottom: 60px;
}

.contactFormHeading {
  color: rgb(255, 255, 255);
  margin-bottom: 10px;
  font-weight: lighter;
}

.contactFormHeading p {
  color: rgb(255, 255, 255);
  font-weight: lighter;
  margin-bottom: 40px;
}

.contactFormContent {
  color: rgb(255, 255, 255);
  list-style-type: none;
  line-height: 270%;
}

.contactFormInput {
  width: 100%;
  margin-bottom: 28px;
}

.contactFormInput:focus {
  border-color: rgb(30, 30, 30);
  border-width: 0.25rem;
}

.contactFormMessage {
  height: 140px;
}

input.contactFormSubmit[type="submit"] {
  background-color: rgb(255, 255, 255);
}
<div class="columns six">
  <input class="contactFormInput" type="text" placeholder="Your Name *" required="required" />
  <input class="contactFormInput" type="text" placeholder="Your Email *" required="required" />
  <textarea class="contactFormInput contact-message" placeholder="Your Message *" required="required"></textarea>
  <input class="contactFormSubmit" type="submit" value="Send Message" />
</div>

I have included two additional images in this question

see image here

    .contactFormInput {
    width: 100%;
    margin-bottom: 28px;
    background-color: rgb(255,255,255);
}


.contactFormInput:focus,
input.contactFormInput:focus {
    border: 1px solid rgb(30,30,30);
    background-color: rgb(230,230,230);
}

.contactFormMessage {
    height: 140px;
    background-color: rgb(255, 255, 255);
}

Answer №1

Your current solution should do the trick.

There might be some conflicting css or js causing issues.

Try setting a default border for your .contactFormInput class and then customize it using :focus.

.contactFormInput {
    width: 100%;
    margin-bottom: 28px;
    border: 1px solid #ddd;
}


.contactFormInput:focus {
    border-color: rgb(30,30,30);
    border-width: 0.25rem;
}

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

What is preventing my h1 styles from being applied to an h1 element within a <section> tag?

I have a headline in my header and in another part of the content. I've been told that this can impact SEO, but I'm just starting out by copying other people's pages and trying to replicate their styles without looking at their code. The st ...

What is the best method for saving and accessing a user-entered date using session storage?

https://i.sstatic.net/I8t3k.png function saveDateOfBirth( dob ) { sessionStorage.dateOfBirth = dob; } function getDateOfBirth() { document.getElementById("confirm_dob").textContent = sessionStorage.dateOfBirth; } function pr ...

JavaScript innerHTML not functioning properly when receiving a response from a servlet

Can someone help me troubleshoot the code below? I'm receiving a response from the servlet, but I can't seem to display it inside the div. Here is the response: lukas requests to be your friend &nbsp <button value="lukas"onclick="accfr(th ...

After processing PHP code, display the page to the user immediately

When a user is on index.php: <form align="center" action="send.php" method="post"> address:<input type="text" name="address"/><br> <input id="submit" type="submit" name="submit" value=""> </form> I want to create a f ...

Establish a background image for a particular item within a list

Employing Ionic 2 with Typescript. I am seeking a way to empower users to choose the background color for each item in my list. ISSUE: How can I retrieve the reference to the i-th element? Whenever I select an item, it only changes the background of the ...

Ways to confirm the validation of radio buttons in a form and implement CSS

I am having trouble adding validation to a form with radio buttons displayed as labels. I want to show a red border around the radios/labels or outer div when a radio button hasn't been checked before the user submits the form. I have attempted this ...

Using CSS, you can utilize a three-dot pattern to create a unique X

Hey there! I've got a menu with three dots that animate, and when I click on them, I want them to transform into an X shape. You can check out the demo here: demo Here's the HTML: <div class="dots"> <div class="dot"></div> & ...

Expanding the blank area on the right margin of the page

Recently, I took a responsive website template and converted it into an ASP.NET MVC app. However, I've encountered some peculiar behavior when resizing the browser window. As the width of the window decreases below 986 pixels, a mysterious white "spac ...

What is the best way to submit a form inside a Bootstrap (4) modal that only contains hidden inputs when pressing the enter key?

I have set up a form within a Bootstrap modal that contains hidden inputs and a concealed submit button. The goal is for the user to click a button, open the modal, and then press the enter key to automatically submit the form. Through my research and tes ...

Is it possible for me to create an immersive HTML5 game that utilizes the entire screen

I'm currently designing an extraordinary HTML5 game. Is there a convenient way to offer the user a handy button for effortlessly switching to full-screen mode? This should work seamlessly across all popular browsers, without any compatibility limitat ...

How can I display a blank date picker using Material UI in a REACT application?

CURRENT SETUP <MuiPickersUtilsProvider utils={DateFnsUtils}> <DatePicker fullWidth value={dob} label="Date of Birth" format="dd / MM / yyyy" margin="normal" maxDate={new Date() ...

Tips for ensuring a modal stays fixed while scrolling

I need help with a pop up modal on my website. I want the modal to stay in place even when scrolling down the page. Here is the code for my modal: <div class="modale" id="ouibounce-modal" style="display:none"> <button type="button" i ...

What is the method of aligning content to the left side in a slick slider?

My slider is set up to display three elements, but I'm having trouble aligning one or two elements to the left instead of centering them. jQuery(function () { jQuery('.slider-blog').slick({ arrows: false, dots: true, ...

Several ways to display images with interactive captions

I am in need of multiple image modals with different descriptions. Each image should have a unique caption that appears when clicked. I have searched for solutions that display alt text for each image, but I require it to show other specific texts upon cli ...

What is the best way to layer multiple navigation menus on top of each other using z-index?

I'm facing a challenge trying to position or overlap two navigation menus in my project. The technologies I am using are Bootstrap, HTML, and CSS. It seems like I might need to utilize the z-index property, but I'm unsure about the exact impleme ...

Why isn't the selected option appearing first?

I have written a PHP code to display the specified div <div id="main_catsel"> <select id="maincat" > <option value="1">none</option> <option value="2">Computer</option> <option value="4">Refrigerator& ...

A step-by-step guide on initializing and setting a cookie value with expiration

Below is the code I have added. Can someone please help me locate the bug? Here is the code snippet: $_SESSION['browser'] = session_id(); setcookie($expire, $_SESSION['browser'], time() + (60 * 1000), "/"); echo "Value is: " . $_COO ...

Overlay a translucent navbar above a jumbotron using Bootstrap

I'm interested in creating a landing page design with a large jumbotron at the top and a transparent navbar overlaid on it, similar to the layout on this website: https://stripe.com/en-gb-dk. The jumbotron will simply have a colored background, withou ...

problem with angular.isNumber

Could someone please explain why I am encountering an issue with angular.isNumber(Number("1s")) The output I am receiving is : var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "1s"; ...

Create a form with two divs inside: one positioned in the middle and the other at the bottom

I have organized a responsive form of div with a central and bottom alignment. The code I have included is as follows: <link href="../css/bootstrap-theme.min.css" rel="stylesheet" /> <link href="../css/bootstrap.min.css" rel="stylesheet" /> &l ...