React
by MathyouMB
HTML
<div id="app"></div>
CSS
.card {
/* Add shadows to create the "card" effect */
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 40%;
margin:2em;
}
.card-image{
width:100%;
}
/* On mouse-over, add a deeper shadow */
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
/* Add some padding inside the card container */
.container {
padding: 2px 16px;
}
React
function Card(props) {
return (
<div className="card">
<img className="card-image" src={props.url}></img>
<div className="container">
<h4><b>{props.name}</b></h4>
<p>{props.text}</p>
</div>
</div>
);
}
function App(){
return(
<div>
<Card name="Photo 1" text="a cool photo" url="https://www.w3schools.com/howto/img_avatar.png"/>
</div>
)
}
ReactDOM.render(<App />, document.querySelector("#app"))