Home > OS >  Using style="" in React/Bootstrap makes page blank
Using style="" in React/Bootstrap makes page blank

Time:01-06

Code

import React from "react";
import 'bootstrap/dist/css/bootstrap.css';
const Downloads = () => {
  return (
    <div >
        <div >
  <div >
    <h5 >Card title</h5>
    <h6 >Card subtitle</h6>
    <p >Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" >Card link</a>
    <a href="#" >Another link</a>
  </div>
</div>
    </div>
  );
};
  
export default Downloads;

In the Code above, it works as long as i don't add style= , the same happens everytime i add it anywhere. for example

<div> 

works but

<div style=""> 

does not.

I tried reinstalling bootstrap. Expected: Should Show page with its contents.

CodePudding user response:

Try writing your style like this :

style={{color: "red", border: "2px solid red"}} // for example

And your class= must be className=

With React, you can't write attribute as in HTML

  • Related