पिछले topic में आने CSS के बारे में पढ़ा और समझा , इस topic में हम बात करेंगे कि CSS का syntax क्या है , और इसे कैसे use करते हैं।


Inline या Internal CSS के लिए CSS को style tag से define करते हैं।
For Example:

 h1(selector)
 {
   color(property) : red(value);
 }

Explain

  • h1 : h1 एक selector है , जो कि एक HTML element है जिसके ऊपर हम CSS apply कर रहे हैं। selectors कई तरह के होते हैं जैसे element selector, class selector, ID selector. हालांकि इनके बारे में हम आगे बात करेंगे।

  • color : यह css style की property का name है। यह color का मतलब है कि element का हम color define कर रहे हैं।

  • red : यह property की value है।


हालांकि ऐसा नहीं है कि , एक element के लिए सिर्फ एक ही property define करें या एक ही element select करें आप अपनी need के according कितने ही elements पर एक साथ style apply कर सकते हैं।

body,p{
  color : red;
  background-color : black;
}

CSS Example

File : test.html

Copy Fullscreen Close Fullscreen Run
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>CSS Example</title>
    <style>
      /*change page background color:black*/
      body {
      background-color: black;
      }
      
      /*all h3 headings color : red*/
      h2 {
        color: red;
      }
      
      /*it will apply on all paragraps */
      p {
        font-family: verdana;
        font-size: 20px;
        color: green;
      }</style>
  </head>
  <body>
    <h2>Hello Learners</h2>
    <p>This is paragraph</p>
  </body>
</html>

I Hope, अब आप समझ गए होंगे कि किस तरह से CSS define करते हैं।

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers