:only-of-type





css/style.css
  • p:only-of-type {
  •  color: #F00;
  •  font-size: 36px;
  • }
p:only-of-type {
 color: #F00;
 font-size: 36px;
}


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  • </head>
  • <body>
  •  <div>
  •   <p>Hello World!</p>
  •  </div>
  •  <div>
  •   <p>Hello World!</p>
  •   <p>To be or not to be?</p>
  •   <p>Привет Мир!</p>
  •  </div>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  • </head>
  • <body>
  •  <div>
  •   <p>Hello World!</p>
  •  </div>
  •  <div>
  •   <p>Hello World!</p>
  •   <p>To be or not to be?</p>
  •   <p>Привет Мир!</p>
  •  </div>
  • </body>
  • </html>