0

私はこの CSS を持っていますが、要素には固有のクラスが必要です。または、それを使用している Web サイトの作成に使用される CSS に干渉します。

img{
    display:inline-block;
    width:211px;
    height:146px;
    border:1px solid white;
    vertical-align:top;
    margin-right:10px;
}

div{
    display:inline-block;
    width:311px;
}

次のような一意のクラスにする必要があります。

img.example{
    display:inline-block;
    width:211px;
    height:146px;
    border:1px solid white;
    vertical-align:top;
    margin-right:10px;
}

div.example2{
    display:inline-block;
    width:311px;
}

そもそも、それはそれらをクラスにする正しい方法ですか?

もしそうなら、どうすればこの HTML の "**" セクションに適用できますか? div は div.example2 ? になります。img.example を使用するのはどうですか?

<!doctype html>
<html class="no-js" lang="en">
    <head>
        <link rel="stylesheet" href="css/style.css" />
        <!--[if lt IE 9]>
          <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="accordion vertical">
          <section id="vertabout">
              <h2><a href="#vertabout">Tutor-Led Course</a></h2>


**<img src="http://bathnes.learningpool.com/draftfile.php/2592/user/draft/826412532/TutorLedCourse.jpg" height="134" width="208" />**
**<div>To view the tutor-led course information, please click <a href="http://bathnes.learningpool.com/course/view.php?id=187">here</a></div>**
<p><strong>IT Courses - Excel 2010 Basic</strong></p>
          </section>
          <section id="vertservices">
              <h2><a href="#vertservices">E-Learning Module</a></h2>
                      <p><p><img src="http://bathnes.learningpool.com/draftfile.php/2592/user/draft/826412532/RelatedELearning.jpg" height="146" width="211" /> </p></p>
          </section>


        </div>
    </body>
</html>

申し訳ありませんが、私は CSS と HTML が苦手です :)

4

1 に答える 1

2

これは、クラスを持つタグを選択する適切な方法ですが、クラスを追加する必要があります。

<img src="http://bathnes.learningpool.com/draftfile.php/2592/user/draft/826412532/TutorLedCourse.jpg" 
    height="134" width="208" class="example"/>
<div class="example2">To view the tutor-led course information, please click <a href="http://bathnes.learningpool.com/course/view.php?id=187">here</a></div>
于 2013-05-08T08:55:38.053 に答える