2つ以上のstyleとかclassをcssで指定するにはどうすればいいんでしょうか?
言葉がわからず、、、、よろしくお願いします。
気になる質問をクリップする
クリップした質問は、後からいつでもMYページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
回答1件
0
ベストアンサー
的外れかもしれませんが、以下のように行うことができると思いますが、いかがでしょうか?
HTML
1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="UTF-8"> 5 <title>タイトル</title> 6 <style type="text/css"> 7 div { 8 width: 200px; 9 height: 200px; 10 background: blue; 11 } 12 13 div[class="box"][style="background: red;"] { 14 border: 3px dotted #000000; 15 } 16 </style> 17</head> 18<body> 19<div class="box"></div> 20<div class="box" style="background: red;"></div> 21<div style="background: red;"></div> 22</body> 23</html>
参考: 6.3.1. Attribute presence and value selectors - Selectors Level 3
Multiple attribute selectors can be used to represent several attributes of an element, or several conditions on the same attribute. Here, the selector represents a span element whose hello attribute has exactly the value "Cleveland" and whose goodbye attribute has exactly the value "Columbus":
span[hello="Cleveland"][goodbye="Columbus"]
投稿2017/09/11 14:50
編集2017/09/11 14:51総合スコア14731
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/11 15:02
2017/09/11 20:35
2017/09/12 00:59
2017/09/12 01:11
あなたの回答
tips
太字
斜体
打ち消し線
見出し
引用テキストの挿入
コードの挿入
リンクの挿入
リストの挿入
番号リストの挿入
表の挿入
水平線の挿入
プレビュー
質問の解決につながる回答をしましょう。 サンプルコードなど、より具体的な説明があると質問者の理解の助けになります。 また、読む側のことを考えた、分かりやすい文章を心がけましょう。