0

I am working on a project where I am using react-bootstrap but also my own custom css for styling. I import both in my index.js as follows:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import 'bootstrap/dist/css/bootstrap.min.css';
import './App.css';

Then I have an div that I give the className of select. My goal is to make the h2 in that div smaller than it would be under bootstrap.

import React, {useState} from 'react' import {Dropdown, DropdownToggle, DropdownMenu, DropdownItem, Row, Col, Container } from 'react-bootstrap'

export default function RatingSelection() {
    const [firstOpen, setFirstOpen] = useState(false)
    const [secondOpen, setSecondOpen] = useState(false)
    return (
        <div classame='select'>
            <h2 >Compare ratings for 
                <span>
                    <Dropdown
                    className='inline-drop'
                    isOpen={firstOpen}
                    toggle={firstOpen}
                    size="lg"
                    >
                         <Dropdown.Toggle variant="info" id="dropdown-basic">
                            select a rating
                        </Dropdown.Toggle>
                        <Dropdown.Menu>
                        <Dropdown.Item>
                            Chess.com: Bullet
                        </Dropdown.Item>
                        </Dropdown.Menu>

                    </Dropdown>
                </span> 
                and 
                <span>
                    <Dropdown
                    className='inline-drop'
                    isOpen={firstOpen}
                    toggle={firstOpen}
                    size="lg"
                    >
                         <Dropdown.Toggle variant="info" id="dropdown-basic">
                            select a rating
                        </Dropdown.Toggle>
                        <Dropdown.Menu>
                        <Dropdown.Item>
                            Chess.com: Bullet
                        </Dropdown.Item>
                        </Dropdown.Menu>
                    </Dropdown>
                </span> 
                
                </h2>
                    
        </div>
    )
}

I have removed some of the code the above component to make it shorter and easier to read. There was about 100 lines of code from dropdown items. In the below CSS from app.css I am trying to adjust the height of the h2 within the select class.

.select h2, span{
  font-size: 10px!important
}

However, this css is not overriding the size of my h2s. Oddly enough, if I add ! to the 10px, it will adjust the vertical alignment of my spans, but not the size of the text within them. Would anyone be able to help me understand what I am doing wrong?

2 Answers 2

0

Hello I saw your code but I think you didn't write important with the exclamation sign

Please find the code below:

.select h2, span{ font-size: 10px !important }

1
  • That's embarassing. I can't believe I forgot to add important. Unfortunately that did not fix the overall issue though :(. Thanks for your help!
    – David Reke
    Commented Jul 28, 2021 at 16:42
0

It turns out the issue was that classame spelled wrong. Its spelled className

1
  • 1
    Typo questions should be closed. They don't benefit the community in a meaningful way.
    – isherwood
    Commented Nov 25, 2022 at 17:08

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.