I have two sets of text that need to be inline with each other but at the moment one is placed higher than the other. The two sets of text share the same CSS code so when I edit it, both are affected. However, I would like to target only one of the text; Is there a way of doing this?

我有两组文本需要彼此内联,但目前一个文本放在另一个上面。这两组文本共享相同的CSS代码,因此当我编辑它时,两者都会受到影响。但是,我想只针对其中一个文本;有办法做到这一点吗?

Here is the HTML and CSS:

这是HTML和CSS:

<div id="mi-slider" class="mi-slider">
<?

$result = $mysqli->query("SELECT * FROM stock");
while($obj = $result->fetch_object())
{
    if($obj->id&1)
    echo "<ul>";

?>
<li class="<?=$obj->orientation=='landscape'?'landscape':'portrait'?>" id="list">
    <a href="#"><img src="./img/<?=$obj->description=='unframed'?$obj->poster_no:$obj->poster_no.'_frame'?>.jpg" alt=""></a>
    <h4><?= $obj->description=="unframed"?"Unframed Poster - 750mm x 500mm":"Framed Poster - 790mm x 540mm"?><br />&pound;<?=$obj->price?> each</h4>
</li>

The CSS code:

CSS代码:

.mi-slider ul li h4 {
display: inline-block;
font-family: HelveticaNeueRegular;
font-weight: 100;
font-size: 12px;
color: #a34235;
padding: 0 0 0;
text-align: left;
margin-top: 20px;
margin-left: 10px;
float: left;
}

3 个解决方案

#1


1

If you want to target the second list items H4, you can use the nth-child selector, as below:

如果要定位第二个列表项H4,可以使用第n个子选择器,如下所示:

.mi-slider ul li:nth-child(2) h4
{ your css }

更多相关文章

  1. 10段实用的HTML5代码
  2. 如何将添加到ajax html编辑器的文本保存为html文档?
  3. 如何将每个单词都包含在一个span中,同时保留文本格式
  4. 文本输入占位符不在IE和Firefox中显示
  5. 用JavaScript实现两种功能:1、切换全选/全不选文字;2、根据选中个
  6. HTML5+学习笔记2-------边看代码边研究貌似还是有点问题...还在
  7. PHP代码在不需要时在Javascript中自动运行[重复]
  8. 如何控制html代码中DL标签的颜色?
  9. php 读取文本文件

随机推荐

  1. PHP_CodeSniffer安装和使用教程(自动代码
  2. php程序员经常忽略的冷门知识点
  3. Laravel 批量插入(insert)数据
  4. php中SSL certificate https问题解决方案
  5. php设置随机ip访问
  6. Laravel数据库获取值的常用方法
  7. PHP过滤数组中的0、null、false和''等空
  8. php使用QueryList轻松采集JavaScript动态
  9. php JSON数据格式化(美化)的方法
  10. PHP替换回车换行符的三种方法