কম্পিউটার টিউটোরিয়াল

CSS-এ :first-child 의사-ক্লাস


CSS :first-child 의사-ক্লাস সেই এলিমেন্টকে সিলেক্ট করে যা অন্য একটি এলিমেন্টের প্রথম চাইল্ড এলিমেন্ট।

সিনট্যাক্স

সিনট্যাক্স নিচের মতো:

:first-child{    /*declarations*/ }

উদাহরণ

CSS first-child 의사-ক্লাসের উদাহরণ:

<!DOCTYPE html> <html> <head> <style> table {    margin: auto;    padding: 10px;    border: hsl(54, 100%, 50%) solid 13px;    border-radius: 6px;    text-align: center; } td, th {    border-left: 2px solid black;    border-top: 3px solid black; } td:first-child, th:first-child {    border-left: none; } th {    background-color: lightblue;    border-top: none; } caption {    margin-top: 3px;    background-color: purple;    caption-side: bottom;    color: white;    border-radius: 20%; } </style> </head> <body> <table> <caption>MCA Syllabus</caption> <tr> <th colspan="4">Subjects</th> </tr> <tr> <td>C</td> <td>C++</td> <td>Java</td> <td>C#</td> </tr> <tr> <td>MySQL</td> <td>PostgreSQL</td> <td>MongoDB</td> <td>SQLite</td> </tr> </table> </body> </html>

আউটপুট

উপরোক্ত কোডের আউটপুট:

first-child 의사-ক্লাস সিলেক্টর ব্যবহার করার আগে:

CSS-এ :first-child 의사-ক্লাস

first-child 의사-ক্লাস সিলেক্টর ব্যবহার করার পরে:

CSS-এ :first-child 의사-ক্লাস

উদাহরণ

আরেকটি CSS first-child 의사-ক্লাস উদাহরণ:

<!DOCTYPE html> <html> <head> <style> * {    font-size: 1.1em;    list-style: circle; } li:first-child {    background-color: seashell;    font-family: cursive; } li:nth-child(2) { background-color: azure; font-family: "Brush Script Std", serif; } li:last-child {    background-color: springgreen;    font-family: "Gigi", Arial; } </style> </head> <body> <h2>Apache Spark</h2> <ul> <li>Apache Spark is a lightning-fast cluster computing technology, designed for fast computation. </li> <li>It is based on Hadoop MapReduce.</li> <li>It extends the MapReduce model to efficiently use it for more types of computations. </li> </ul> </body> </html>

আউটপুট

উপরোক্ত কোডের আউটপুট:

CSS-এ :first-child 의사-ক্লাস


  1. CSS-এ min-width প্রোপার্টি

  2. CSS-এ outline-width প্রোপার্টি

  3. CSS-এ :nth-child Pseudo-class

  4. CSS border-color প্রপার্টি: বর্ডার রঙ এবং পক্ষাবদ্ধ রঙ