css - 尝试在 CSS 中将 "figure"标记居中(不使用 Div)

标签 css html

我目前是第一次尝试创建一个网站,我很难让我的 3 个内联 block 图像在 CSS 中正确居中。

我使用 figure 标签来为我的图像添加标题和显示(效果很好,没问题)。

但是当我回过头来将 3 张图片水平内嵌放置时,尽管我尽了最大努力,但它们不会从屏幕左侧移动。

figure {
    text-align: center; 
    font-family: 'Rasa', serif;
    font-size: 18px; 
    display: inline-block;
    align-content: center;
    max-width: 700px;
    margin: auto;
    float: center;
}

如果能帮助指出我做错了什么或遗漏了什么,我将不胜感激。

最佳答案

这就是你想要做的吗?

HTML:
<div class="figure">
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
</div>

CSS:
.figure {
    text-align: center; 
    font-family: 'Rasa', serif;
    font-size: 18px; 
    display: inline-block;
    align-content: center;
    max-width: 700px;
    margin: auto;
    float: left;
}
.box{
  height:30px;
  width:30px;
  border:1px solid black;
  float:left;
}

This is what it looks like

关于css - 尝试在 CSS 中将 "figure"标记居中(不使用 Div),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48081656/

相关文章:

html - 使用 svg 路径和 raphael js 进行 3D 翻转

css - 如何更改 Safari 8 的 Web 检查器字体?

html - 使用 MailTo 链接,我可以向发件人发送副本吗?

html - 转义 h 大纲

javascript - JS 表单验证不适用于 html 表单

php - 访问图像数组中的单个元素

css - 没有标签的纯 CSS 复选框按钮(jQuery 是一种可能的解决方案)

css - 使文本在任意背景图像上可读

html - Rails 复选框和标签在同一行

html - 侧边栏宽度恒定的 CSS 两列布局