Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

css react

import "./FileName.css"; // import your css file

// or css inside your react file
//for example:
const MyDiv = React.createClass({
  render: function() {
    const style = {
      color: 'white',
      fontSize: 200
    };
    
    return <div style={style}> Have a good and productive day! </div>;
  }
});
Comment

Styling React Using CSS

//Use backgroundColor instead of background-color:
const Header = () => {
  return (
    <>
      <h1 style={{backgroundColor: "lightblue"}}>Hello Style!</h1>
      <p>Add a little style!</p>
    </>
  );
}
Comment

react style

marginHorizontal
alignContent
alignSelf
aspectRatio
borderBottomWidth
borderEndWidth
borderLeftWidth
borderRightWidth
borderStartWidth
borderTopWidth
borderWidth
bottom
display
end
flex
flexBasis
flexDirection
flexGrow
flexShrink
flexWrap
height
justifyContent
left
margin
marginBottom
marginEnd
alignItems
marginLeft
marginRight
marginStart
marginTop
marginVertical
maxHeight
maxWidth
minHeight
minWidth
overflow
padding
paddingBottom
paddingEnd
paddingHorizontal
paddingLeft
paddingRight
paddingStart
paddingTop
paddingVertical
position
right
start
top
width
zIndex
direction
Comment

css in reactjs

Assuming you have 2 separate files: Example.css and Example.js

Use the '.' to reference a className that you'll use later 

.primary{
	color: red;
}

<h1 className="primary"> Hello, World </h1>

In this case "primary" in the className is referencing .primary in the CSS file
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to use json stringify in javascript 
Javascript :: adding a if stement in jsx 
Javascript :: js html editor 
Javascript :: $.get jquery return value 
Javascript :: mongoose encrypt password 
Javascript :: postman environment variables 
Javascript :: javascript convert minus to plus 
Javascript :: how to target checkbox in jquery 
Javascript :: end session express 
Javascript :: how to find last element of an array 
Javascript :: points in three js 
Javascript :: create bottom navigation bar react native 
Javascript :: swr npm 
Javascript :: js jwt decode 
Javascript :: how to concatenate in javscript 
Javascript :: javascript add to home screen button 
Javascript :: difference between ajax and node js 
Javascript :: angular style component tag 
Javascript :: function that search a biggest value in array javascript 
Javascript :: Adding A forEach Function To An HTMLCollection JavaScript 
Javascript :: javascript string new line 
Javascript :: jquery slider move event 
Javascript :: array -1 javascript 
Javascript :: chrome dino game 
Javascript :: what regular expression will match valid international phone numbers 
Javascript :: counter in html and js 
Javascript :: react route props 
Javascript :: props comment 
Javascript :: dedecting invalid date in js 
Javascript :: run node script pupeeter when button from form clicked 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =