Ways to apply inline styling with CSS in a React class-based component

Is it possible to apply inline CSS in a React class component?

Here is an example of the CSS I have:

{
    font-size: 17px;        
  
    font-family: Segoe UI Semibold;
    color: #565656;
    text-shadow: 0 1px 1px white;
}

While this CSS works fine when read from a CSS file, I am unable to directly write it in my CSS class as it comes from a library. So, how can I make it inline?

Working Inline CSS Example:

<div style= {{border : "1px solid #ced4da", overflow : "auto", height : "300px"}}>

Not working Inline CSS Example:

<div style= {{font-size: 17px, font-family: Segoe UI Semibold, color: #565656, text-shadow: 0 1px 1px white}}>
                    

Inline CSS only applies in camel case, so how can I overcome this limitation? Is there an alternative solution for this issue?

Answer №1

Avoid using hyphens in inline CSS by updating the div element to:

<div style= {{fontSize: "17px", fontFamily: "Segoe UI Semibold", color: "#565656" ,textShadow: "0 1px 1px white"}}>
                

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

Troubleshooting AJAX hover functionality issue

Here is the content that loads through AJAX: <div class="grid"> <div class="thumb"> <img alt="AlbumIcon" src="some-image.jpg"> <div style="bottom:-75px;" class="meta"> <p class="title">Title< ...

Is there a reason why Firebase.auth.getUsers does not have filter support?

Can someone please check out my code below and help me with this issue? When I use FireBase.Auth.getUses(), I am only able to set data like getUses([userId:'dddd']). However, I want to getUsers("userId" containing "@hayan.com"). getAuth() .get ...

Passing dynamically loaded parameters to a function during dropdown value selection in Angular 2

Could you please review if I am passing the parameters correctly in the li tag's click function of the updateId method? The console errors only point to that line. This is my app.component.html code: <div class='form-group' style="width ...

Using PHP to encode JSON and submit it via POST request

Issue: I am encountering difficulty in sending a JSON-encoded variable to a PHP page using jQuery/AJAX. Here is my current approach. The file is uploaded through It undergoes processing using jQuery based on the following JS code. JS code: <scrip ...

Tips for combining data from various sources in GraphQL

Need some guidance on setting up GraphQL as a beginner. I am facing challenges in efficiently setting up resolvers for my schema, especially when dealing with fields from different backend APIs. type User { name: String address: String dateOfBirth ...

Combining Vue and Laravel: Efficiently retrieve API data stored as an array within a tuple

I am facing an issue with setting data from an API into an array in vue.js. The data obtained is in JSON format from the API. Could you please guide me on the syntax for this? {"id":1613, "name_org":"US company", "picture":"default.jpg", "headerpic":"no- ...

Using AngularJS to create a placeholder for a <select> element within ng-repeat

I’ve been facing a challenge while trying to insert a placeholder within an html select tag utilizing ng-repeat for an AngularJS application. Here is the JS fiddle link This is how my HTML structure appears: <div ng-repeat="item in items"> <d ...

Mysterious links socket.io

Exploring the world of React+Socket.io, I decided to develop a basic application that updates values in real-time using +/- buttons. However, during this process, I encountered a few issues. I noticed that my server was establishing new connections with d ...

Python: The soup/parser module is unable to locate the element with the id "div"

I am facing a challenge locating anything within the "div" with the id "bbOffers" (including the div itself) on this particular page: from bs4 import BeautifulSoup from urllib.request import urlopen url = "https://lubimyczytac.pl/ksiazka/5076165/fute ...

Is there a way to make a text area move along with the mouse cursor?

I have been working on my first website and everything is running smoothly so far. However, I have a new idea that I am struggling to implement. Some of the pages on my site feature a video player with buttons to select different videos. When a viewer hove ...

Colorful Background Switcher

I am looking to create a set of buttons representing the colors ROYGBV. I want to use JavaScript to apply a function that will change the background color when each button is clicked. The current code I have seems too lengthy. Can someone assist me with ...

Encountered an error while attempting to load resource: the server returned a 404 (Not Found) status code when trying to load an image in an

I am looking to dynamically load an image when it is selected from a file picker dialog. The code provided below attempts to achieve this, however, the image does not load into the img tag. <script src="https://cdnjs.cloudflare.com/ajax/libs/jq ...

Creating a triangle with SVG polygon: A step-by-step guide

I'm attempting to create a bottom triangle using SVG polygons, similar to the image below: https://i.stack.imgur.com/571FM.png Here is what I have tried so far: <svg xmlns="http://www.w3.org/2000/svg" height="150px" width="100%" viewBox="0 0 ...

Having trouble navigating the maze of Express routing

app.js file // home route app.get("/home", async(req, res)=>{ let allCards = await Card.find({}); let skills = await Skill.find({}); res.render("index", {allCards, skills}); }) // add new skill route app.get("/home/newskill", (req, res)=& ...

Unable to Modify Header Link Font Color

I've been struggling to change the link color of a header on my website. By default, the link color in my CSS is blue, but I want the links in my entry headers to be gold. I thought this would be a simple task - just define the link color for the hea ...

Generating DOM elements at specific intervals using Jquery

I am looking to dynamically create 1 div container every x seconds, and repeat this process n times. To achieve this, I have started with the following code: $(document).ready(function() { for (var i = 0; i < 5; i++) { createEle(i); } }); f ...

Sending a JWT token to a middleware with a GET request in Express Node.js - the proper way

Struggling with Js and web development, I've scoured the web for a solution to no avail... After completing a project for a small lab, my current challenge is creating a login page and generating a web token using JWT... I successfully created a use ...

Building a like/dislike feature in Angular

Here is a snippet of code I have that includes like and dislike buttons with font-awesome icons: <ng-container *ngFor="let answer of question.answers"> <p class="answers">{{answer.text}} <i class="fa fa-hand-o-le ...

The 'refresh' function in jQM listview is causing issues with inset lists

For some reason, I am struggling to understand why this issue is occurring: In jQuery Mobile, I have an unordered list with data-inset="true". Initially, it displays perfectly with rounded top and bottom edges. However, on dynamically adding new elements t ...

What could be causing the issue with these overload calls?

Hey there, I've encountered an issue while using createStore. Can someone please guide me on what I might be doing incorrectly? TypeScript error in /workspace/weatherAppTypescript/App/appfrontend/src/redux/store/index.ts(7,31): No overload matches th ...