いつもお世話になっております。
質問は表題の通りです。
htmlでtableを作成し、cssでthとtdにborder-bottomをつけることで、下線がついているようなデザインに見せています。
そして、一番初めのthとtdにはborder-topも付けたいので、下記コードのように記述したのですが、
なぜかthにはつくのですが、tdにはつきません。
#company table tr th:first-child,#company table tr td:first-childを複数指定で記述していますが、これを別々にしても動きませんでした。
他に必要情報がありましたら追記しますのでおっしゃってください。
宜しくお願いします。
html
1<div id="company"> 2 <table> 3 <tr> 4 <th> 5 <p> 6 社名 7 </p> 8 </th> 9 <td><p> 10 sample</p></td> 11</tr> 12<tr> 13 <th><p>会社設立</P></th> 14 <td><p> 15 sample 16 </p></td> 17</tr> 18<tr> 19 <th><p>東京本社</p></th> 20 <td> 21 <p> 22 sample</p> 23 <p> 24 </td> 25</tr> 26</table> 27
css
1#company table{ 2 width: 85%; 3 margin: 0 auto; 4 margin-top: 40px; 5} 6 7#company table tr th,#company table tr td{ 8 border-bottom: 1px solid rgb(213, 217, 227); 9} 10 11#company table tr th:first-child,#company table tr td:first-child{ 12 border-top: 1px solid rgb(213, 217, 227); 13} 14 15#company table tr th{ 16 vertical-align:top; 17 padding-top: 20px; 18 width: 100px; 19} 20 21 22#company table tr td{ 23 padding: 20px 0; 24} 25 26#company table p{ 27 font-size: 15px; 28} 29

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/04/10 11:39
2018/04/10 11:44