HTML的CSS语法-在我的HTML中使用img.example元素
我有这个CSS,但是元素需要一个唯一的类,否则它们会干扰用于创建我正在使用它的网站的CSSHTML的CSS语法-在我的HTML中使用img.example元素,html,css,Html,Css,我有这个CSS,但是元素需要一个唯一的类,否则它们会干扰用于创建我正在使用它的网站的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{
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>
****
**要查看导师指导的课程信息,请单击**
IT课程-Excel 2010基本版
很抱歉,但是我对CSS和HTML很糟糕:)这是选择带有类的标记的正确方法,但是您需要添加类
<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>
要查看导师指导的课程信息,请单击
重复感谢,这绝对有帮助。还有一个小问题,文本在图像的右边,就像我想要的一样,但是它就像[].\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu。当我创建一个虚拟html页面并尝试它时,文本是[]'',其中[]是图像,''是文本。知道它为什么这么做吗?(我希望文本位于图像顶部,如第二个示例所示。)