CSS
 Computer >> コンピューター >  >> プログラミング >> CSS

CSSの役割:読み取り/書き込みセレクター


CSS:read-writeセレクターを使用して、「読み取り可能」および「書き込み可能」な要素を選択します。

次のコードを実行して、:read-writeセレクターを実装してみてください:

<!DOCTYPE html>
<html>
   <head>
      <style>
         input:read-write {
            background-color: blue;
            color: white;
         }
      </style>
   </head>
   <body>
      <form>
         Subject: <input type = "text" name = "subject" value = "Java"><br>
         Student: <input type = "text" name = "student" readonly value = "Amit"><br>
      </form>
   </body>
</html>

  1. CSSの役割:nth-​​last-of-type(n)セレクター

    CSS:nth-​​last-of-type(n)セレクターを使用して、最後の子から数えて、親の2番目の要素であるすべての要素を選択します。 例 次のコードを実行して、:nth-​​last-of-type(n)セレクターを実装してみてください。 <!DOCTYPE html> <html>    <head>       <style>          p:nth-last-of-type(2) {      

  2. CSSの役割:nth-​​last-child(n)セレクター

    CSS:nth-​​last-child(n)セレクターを使用して、最後の子から数えて、親の子であるすべての要素のスタイルを設定します。 次のコードを実行して、:nth-​​last-child(n)セレクター-を実装してみてください。 例 <!DOCTYPE html> <html>    <head>       <style>          p:nth-last-child(4) {