css - 编辑 : How would I go about inlining these span and imgs in CSS?

标签 css image inline html

这是我的 HTML 代码:

        <div id="page" class="cf">
            <a href="#" id="latest">
                <img src="images/fzero.png"/>
                <span> VGC - F-ZERO (SNES) game review</span>
            </a>
        <div class="feature-bar cf">
                <ul>
                    <li>
                        <a class="videos" href="">
                            <img src="images/mario.png" />
                            <span>VGC - Super Mario 64 game review</span>
                        </a>
                    </li>
                    <li>
                        <a class="videos" href="">
                            <img src="images/sf2t.png" />
                            <span>VGC - Street Fighter 2 Turbo (SNES) game review</span>
                        </a>
                    </li>
                    <li>
                        <a class="videos" href="">
                            <img src="images/tekken2.png"/>
                            <span>VGC - TEKKEN 2 (PlayStation) game review</span>
                        </a>
                    </li>
                    <li>
                        <a class="videos" href="">
                            <img src="images/Nintendo64.png"/>
                            <span>VGC - Nintendo 64 console review</span>
                        </a>
                    </li>
                    <li>
                        <a class="videos" href="">
                            <img src="images/Nintendo64.png"/>
                            <span>VGC - Nintendo 64 console review</span>
                        </a>
                    </li>
        </div>

对不起,我没有解释好。但是随着跨度的增加,我希望它们位于 img 之下,但居中于中间。我已将 div 制作成无序列表,还是应该将它们保留为 div?

这是我的 CSS(我是初学者,开始了一个新元素。)

/* F-ZERO */
a#latest img, a#latest span {margin: 30px 0 0 50px;}
a#latest img {
 border: 1px solid #000000;
 display:block;
 max-width: 400px;
 max-height: 100%;
}
/* FEATURE BAR*/
a#latest span {text-align: center;}

a.videos img {
 max-width: 150px;
}
a.videos span {text-align:center;}

最佳答案

imgspan已经是内联元素,需要将div的显示改为内联

.feature-bar div {
  display: inline;
  text-align: center;
}

关于css - 编辑 : How would I go about inlining these span and imgs in CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22146401/

相关文章:

parameters - Rust 标准库闭包参数 : run time or compile time?

javascript - 如何为背景图像提供 (100% - 40px) 高度?

html - 构建与 IE8 兼容的可调整大小的图形/图表时出现问题

asp.net-mvc - ASP MVC 5 图像显示

android - 获取随机图像

html - 4个div,需要居中2个中心div

css - 如何启用 CSS 位置 : sticky in mobile browsers?

html - 如何在父容器内居中对齐div?

jquery - 单击更改图片和背景

c - 在内联函数中获取静态变量的值?