Subscribe Us

header ads

Penggunaan Internal CSS di React

 Berikut contoh penggunaan internal CSS di React,

import React from "react";

export default function App() {
  const style = `
    .container{
      background-color: #f5f5f5;
      padding: 10px;
    }

    .title{
      color: #333;
      font-size: 28px;
    }

    .description {
    color: #666;
    font-size: 16px;
    }
  `;

  return (
    <div>
      <style>{style} </style>
      <div className="container">
        <h1 className="title">Hello, Internal CSS</h1>
        <p className="description">
          This is a simple React application with internal CSS styling.
        </p>
      </div>
    </div>
  );
}

hasilnya akan tampak sbb:



Posting Komentar

0 Komentar