How can I style the header in my navbar with unique colors using CSS in React Bootstrap?

Here is the CSS code snippet I am using:

.h1, h1{
    font-size:2.5 rem;
    font-style:italic;
    color : wheat
 }

I experimented with applying this style to a page header within a navbar element. However, when I refreshed the page, the color style was not being applied to the header. It seems like enclosing the header within the navbar might be causing this issue.

Answer №1

After reviewing your source code:

    <Navbar inverse collapseOnSelect>
       <h1 className="h"> Disciplinary Incidents Tracking </h1> <font size="3"> 
        <Navbar.Collapse>
            <Nav > 
                <NavItem eventKey={1} href="/Register"> Admin Register </NavItem> 
                <NavItem eventKey={2} href="/login"> Admin login </NavItem> </Nav> 
            </Nav> 
        </Navbar.Collapse> 
    </font> // I'm not sure why it's included
    </Navbar>

Your CSS code should be as follows:

h1.h{
    font-size:2.5 rem;
    font-style:italic;
    color : wheat;
 }

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

Styling elements in a React component with CSS to give each item a unique look

My React component, called "Badge", returns text that has bold styling. render() { return ( <div> <Text weight={'bold'}> {this.props.label} </Text> </div> ) Now, I am using the "Badge" component within ano ...

Linking this to a function that takes in arguments

I am currently working with an event handler that calls a fat arrow function to execute a specific method. import React, { Component } from 'react'; class App extends Component { sayHi = msg => { console.log(msg); }; render() { ...

Place the footer element at the bottom of the page in relation to its preceding sibling

Having an element positioned at the bottom of a page can sometimes be tricky, especially when there are elements that slide up and down based on user interactions. On pages with enough content to push the element down naturally, everything works fine. The ...

What techniques can be used to maintain the alignment of an image while the surrounding text changes?

Having trouble aligning my image without affecting its position. When the wind text is hidden (JavaScript not functioning in CodePen), meaning it is not displayed below the temperature, the weather image shifts upwards. I attempted to use 'absolute&ap ...

npm encountered an EPERM error while trying to create a directory

I tried this on my local environment npm install eslint-plugin-react-hooks --save-dev But encountered the following error message: npm ERR! code EPERM npm ERR! syscall mkdir npm ERR! path D:\Users\AOM\node_modules\.corepack-zcmWVMs An ...

Setting the timezone for the DateTimeInput component in React-Admin is a crucial step for

My API returns datetime in the format '2021-12-31T16:00:00.000Z' I need to use DateTimeInput and consistently show it in UTC+8 timezone. After the user submits the form, it should convert back to the original format '2021-12-31T16:00:00.000 ...

Encountering error while using node-fetch in React application - "Module 'node:http' not found"

In my setup, I am using Strapi as a backend and React as a frontend. My main objective is to retrieve data from the API in the backend using any available tool. Initially, I attempted to use Axios for this task but encountered an issue when making a GET ca ...

Adding link styles to the <a> tag in Bootstrap 4 Alpha 3: A simple guide

The following code is quite simple: <a>This is a link</a> In a demonstration of Bootstrap 4 Alpha 2 here, the link appears blue. When you hover over it, it turns dark blue. However, in a demonstration of Bootstrap 4 Alpha 3 here, it displays ...

A single background image split into several div elements

I am facing an issue regarding the background image placement in multiple divs. When I set the position to fixed, the image repeats when I resize the screen. However, changing it to absolute causes each div to have its own image. Is there a solution to fi ...

Tips for creating a textfield with height that responds dynamically in Material UI

I am trying to create a textfield with a responsive height that adjusts itself based on the size of its parent grid when the browser window is resized. I have been searching for a solution and came across this helpful post on Stack Overflow about creating ...

Create custom-shaped images with JQuery's new slicing plugin

I recently tackled the challenge of displaying only a portion of an image using JQuery, specifically the first 200 pixels of its width. After successfully implementing the solution, I’m interested in exploring alternative approaches... Is there a more ...

When a website is deployed to an application, the process includes MVC bundling and managing relative CSS image paths

When trying to convert relative image paths to absolute paths, there are numerous queries on stackoverflow addressing this issue. For example, take a look at this thread: MVC4 StyleBundle not resolving images This question recommends using new CssRewrite ...

Creating a promise instance with the axios create method

As someone who is new to TypeScript, I am learning as I go along. One thing I want to do is create an axios instance that can be reused in my code by passing props only where needed. The framework I'm using is React. // Located in a utils folder // a ...

The top row of a Bootstrap table generated with JavaScript does not display the background color as intended

I am currently using JavaScript to generate some HTML that displays a Bootstrap table. Below is the code for creating this: function displayTableData(d){ let html = ''; html += '<table id="my-table" class="table&q ...

The media query for mobile is not functioning properly

Hello, I have a page with MVC that includes CSS for iPad and mobile devices. The media query for iPad (@media only screen and (min-device-width: 768px) and (max-device-width: 1024px)) works perfectly, but I am struggling to get the media query for mobile ...

How can I access a styled component that is located in a separate DOM?

Can I apply styles to a styled component that belongs to a different DOM? https://i.sstatic.net/9egI3.jpg In the example of Material-ui Menu component, the dashboard button is gray, and the drop-down menu is light blue. Although they are in the same com ...

Would you like to learn how to set an auto-play video as the background in a webpage section, similar to the one found on http://www8.hp.com/in/en/home.html?

I was browsing the HP-India website and noticed they have a cool autoplay video in the background of a section below the header. I would love to recreate something similar on my own website. Any tips on how to achieve this? ...

Default value for the href property in NextJS Link is provided

Is there a default href value for Next/Link that can be used, similar to the way it is done in plain HTML like this: <a href='#' ></a> I attempted to do this with Link, but it resulted in the page reloading. Leaving it empty caused a ...

Tips for rearranging navigation item buttons with react.js and the MUI library

image description placeholder //I was working on adjusting the position of the navigation bar buttons to create space between them $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ //Here is the code snippet whe ...

Ways to adjust the border color when error helper text is displayed on a TextField

I am currently working with React Material UI's TextField element. What I aim to achieve is when the submit button is pressed, the helpertext displayed should be "Please enter the password." It should look like this: https://i.sstatic.net/Nu0ua.png ...