18910140161

HTML-我正在尝试在我的图片下居中对齐我的无花果标题-堆栈溢出

顺晟科技

2022-10-18 12:41:27

157

这是我的图像的HTML代码。

.image1
{
  display: block;
  margin-left: auto;
  margin-right: auto;
}
<代码><;图>;<;IMG SRC=“ https://material.angular.io/assets/img/examples/shiba2.jpg ” alt=“ T恤颜色” Class=“ image1 ”>;<;FigCaption>;有多种T恤颜色可供选择<;/figcaption>;<;/图>;

如何使文本在图像下方居中?


顺晟科技:

这可以通过将figcaption{ text-align: center; } 上的.image1 { display: block; margin-left: auto; margin-right: auto; } figcaption { text-align: center; }属性设置为center来实现,如下所示:

figcaption

您可以尝试添加text-align添加到您的FigCaption标记。

您可以将<figure> <img src="https://material.angular.io/assets/img/examples/shiba2.jpg" alt="T-shirt colors" class="image1"> <figcaption>Choose from are variety of t-shirt colors</figcaption> </figure>的文本居中对齐为

figcaption

<代码>.image1{显示:块;左边距:自动;Margin-Right:自动;}FigCaption{文本对齐:居中;}
<代码><;图>;<;IMG SRC=“ https://picsum.photos/200/300 ” alt=“ T恤颜色” Class=“ image1 ”>;<;FigCaption>;有多种T恤颜色可供选择<;/figcaption>;<;/图>;

将来,您可能需要添加一个小code.io供我们使用。我们不知道你的父框是什么样子的,也不知道你的父框的CSS.

你可能想看看这个。

http://howtocenterincss.com/.

我认为

这是一个非常有用的作弊工具。

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航