CodeSolved

Solved Programming Questions & Exercises

Choose

Practice Easy 211/ Download 458 Views

Pay attention to the following code; CSS Code Write to select the DIV tags within which there is t tags and the color of the backdrop will change to red

<div>
<p> hello </p>
</div>
<div>
<b> bold </b>
</div>
<div>
<p> hello </p>
<p> hello </p>
</div>

8 Answers

<!DOCTYPE html>
<html lang="en">
<head>
  <style>
    div:has(p) {
      background-color: red;}
  </style>
</head>
/********************************/
<body>
  <div>
    <p>hello</p>
  </div>
  <div>
    <b>bold</b>
  </div>
  <div>
    <p>hello</p>
    <p>hello</p>
  </div>
</body>
</html>
<!DOCTYPE html>
<html>
  <head>
    <style>
      div > p {
        background-color: red;
      }
    </style>
  </head>

  <body>
    <div>
        <p>hello</p>
      </div>
      <div>
        <b>bold</b>
      </div>
      <div>
        <p>hello</p>
        <p>hello</p>
      </div> 
  </body>

</html>
<!DOCTYPE html>
<html dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"content="width=device.width, initial-scale=1.0">
  <title> pسلکت تگ های </title>
  </head>
  <style>
    div:has(p) {
    background-color: red;
}
  </style>
<body>
    <div>
        <p>hello</p>
      </div>
      <div>
        <b>bold</b>
      </div>
      <div>
        <p>hello</p>
        <p>hello</p>
      </div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>FORM</title>
    <link rel="stylesheet" href="project.css" type="text/css">
</head>
<body>
    <div>
        <p>hello</p>
      </div>
      <div>
        <b>bold</b>
      </div>
      <div>
        <p>hello</p>
        <p>hello</p>
      </div> 
</body>
</html>
<!--css-->
*{
    padding: 0px;
    margin: 0xp;
    font-style: italic;
    box-sizing: border-box;
}
div > p{
    color: red;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>انتخاب بر اساس فرزند</title>
    <style>
        div p{
            background-color: red;
            color: white;
        }
    </style>
</head>
<body>
    <div>
        <p>hello</p>
      </div>
      <div>
        <b>bold</b>
      </div>
      <div>
        <p>hello</p>
        <p>hello</p>
    </div>
</body>
</html>

<!DOCTYPE html>
<html lang="en";>
<head>
<meta charset="UTF-8">
<meta name="viewport " content="width=device-width,intial-scale=1.0">
<title> box</title>
<style>
div>p{
    background-color: red;
}
div{
    background-color: aqua;
}
</style> 
</head>
<body>
<div >
<p>dfghjk</p>
</div>
<div>
    cfghjkl</div>
</body>
</html>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close