Ways to implement SCSS styles for an input field

A particular styling class named section-changing-input includes a subclass called Input. My aim is to give the input element a red border. But, when I introduce this class into my <input> tag, nothing shows up.

What should I modify in the styling class within my div so that I achieve a red border?

import React from 'react'
import './style/General.scss'


function General() {



    return (
        <div>
            <div className="field">
                <p className="control has-icons-left has-icons-right">
                    <input className="section-changing-input" type="text" value="Hello" />
                    <span className="icon is-small is-left">
                        <i className="fas fa-futbol"></i>
                    </span>
                </p>
            </div>
        </div>
    )
}

export default General

General.scss

section-changing-input {
    input {
        border-color: crimson !important;
    }
}

Answer №1

It appears that the dot for the parent class was overlooked in your code. Additionally, since the main class is assigned directly to the input tag, there is no need for a child element or additional class.

.section-changing-input {
  border-color: crimson !important;
}

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

Steps to turn off fancybox for mobile and show the full image instead

In this scenario... I am seeking a way to deactivate fancybox functionality on mobile devices. I have already discovered one method to disable it... And now I want to directly show the large image in the a href="xxx_large.jpg" instead of using the img src= ...

Adding a class to a clicked button in Vue.js

A unique function of the code below is showcasing various products by brand. When a user clicks on a brand's button, it will display the corresponding products. This feature works seamlessly; however, I have implemented a filter on the brands' lo ...

Issue with background image repeating incorrectly when resizing

I've recently added an image as the background for my website using the following style: #whole_wrapper{ background-image: url(../images/wrapper_bg.jpg); background-repeat: repeat-x; width: 100%; float: left; height: 116px; } ...

What is the best way to insert a horizontal line in the middle of a line and include additional content using Vue.js?

I am working on a Login component and trying to center the content like this image. I have tried using horizontal lines but it's not working as expected. Check out my desired output here: [Output 2]. Can someone help me achieve this with simple HTML a ...

Encountering an Issue with the Development Server in React and TypeScript

My attempt to set up a new TypeScript-React project using the command npx create-react-app todo-list --template typescript was successful in terms of installation. However, when I tried to run the project with npm start I encountered the following error: ...

Using an array of references within a functional component to dynamically change the class names of individual items using the classList property

As I transition my jQuery-based project to React, I encountered a challenge with using refs in a functional component. In this scenario, I have a large wordlist where each word needs to be accessed via its own ref so that individual classNames can be modif ...

SassError: Variable not defined

I have a file containing variables with different themes that I need to override: _vars.scss body { $bg-color: #fff } body.theme-dark { $bg-color: #333 } In my Angular button component, I am referencing these variables: button.scss @import '_va ...

How can React be used to constantly update a string whenever a checkbox is ticked, and subsequently show this updated string in a separate input field

I need to dynamically update a text input field each time a checkbox is checked as true. Could someone provide guidance on how to achieve this? My goal is to have a checkbox trigger an update in another input field. When the checkbox is checked, I want to ...

Tips for keeping a div fixed at a specific scroll level

Is there a way to keep a specific side div fixed at a particular scroll level, similar to the "How to format" bar on the right side of the Stack Overflow ask question page? You can see it when you try asking a question. How can this be achieved - with CS ...

The promise is throwing an error stating that it cannot read the property 'code' of undefined when using the context api in React hooks

I'm currently working on developing my first hybrid web app using React Hooks. I've encountered a timing issue involving promises and the Context API. Here's the challenge I'm dealing with. A function called fetchApplications retrieve ...

Set the maximum height of an image to be the same as the height of another row within a

Currently, I am dealing with a grid that consists of two columns and one row. One cell contains an image that can resize dynamically, while the other cell contains two input fields with fixed height. The issue arises when resizing the window, as the height ...

What steps should I take to resolve this animation issue?

My objective with this card animation is for the cards to expand in size when hovered over. Unfortunately, the current issue is that when one card is hovered over, all the other cards also expand, which is not the intended behavior. I am seeking a solution ...

Unexpected behavior of Bootstrap columns within nested rows, occurring between the small and extra-small breakpoints

Currently, I am in the process of developing a small website using Bootstrap 5. My goal is to have 6 elements displayed on two lines for breakpoints greater than or equal to md and on a single line for smaller breakpoints. It all seems to be working fine f ...

How can you specify the maximum width and height for a TextField in JavaFX using CSS?

Is there a way to set preferred and maximum width and height for a TextField using CSS? ...

What is the process for integrating a popup component into a React-Native application?

As a React-Native beginner, I wanted to incorporate a popup window into my app. After some research, I came across this solution: https://www.npmjs.com/package/react-native-popup I followed the first step: npm install react-native-popup --save However, w ...

Is there a way to streamline the import process for material-ui components?

Is there a shortcut to condense all these imports into one line? As a newcomer to react, I've noticed that every component must be individually imported, especially when it comes to CSS components. Could you provide me with a suggestion on how to st ...

Error: The system is not allowing the operation to create directory 'C:Program Files odejs ode_modules' due to permission restriction

Recently, I decided to delve into learning React Native as a beginner. I encountered an issue while trying to install it using the command npm i -g create-react-native-app. Unfortunately, this did not work for me so I attempted npm i -g react native, but t ...

Positioning the modal toward the bottom across all screen sizes

In my current project, I am utilizing react-bootstrap modal. My goal is to position the modal at the bottom of all screen resolutions. While I have successfully achieved this by adjusting the CSS bottom property to -74% for 1080x1920 resolutions, the same ...

Using nextJS to establish a context within a Server Component and incorporating a new library

I attempted to incorporate Framer Motion into my project, but when I added it, an error occurred. The error message displayed was: TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Fo ...

Unable to modify the CSS properties of the titlebar in jQuery UI dialog

Is there a way to modify the background color of a jQuery UI dialog titlebar? Here is the code I am using: jQuery("#divId").dialog({ title: 'Information' }); jQuery("#divId .ui-dialog-titlebar").css("background-color", "red"); For m ...