1

CSS を使用して作成されたサイトにページを作成しており、CSS を使用してページのスタイルを設定しています。CSS を使用してダミーの html ページを見ると、必要なとおりに動作します。つまり、アコーディオンに画像を配置し、画像の横にテキストを配置します。しかし、サイトで確認すると、自分が使っているCSSが、実際に構築しているWebサイトを作るのに使っているCSSと干渉しているかのように、ページが壊れてしまいます。div と img を変更しようとしましたが、アコーディオンが移動し、テキストが画像の横になくなりました。おそらくご想像のとおり、私は CSS 初心者なので、どんな助けもありがたく思います。

これは、Div と Img パラメータを追加した後に発生しました。

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;
}

そして、ウェブページのコード:

<!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 を削除しました。

4

1 に答える 1