【问题标题】:How can I make the text below an image the same size as the image with the same border?如何使图像下方的文本与具有相同边框的图像大小相同?
【发布时间】:2013-08-10 11:26:24
【问题描述】:

我正在尝试使带有标题的图像大小相同。我希望标题与图像的大小相同,而不是让标题位于图像下方的中心。

这是图片的 CSS:

        article.post 
       .wp-caption img, 
        article.page .wp-caption img {
        border: 2px solid white; 
            outline: 8px solid rgb(245, 222, 179);
        }

这是标题的 CSS:

        article.post .wp-caption, 
        article.page .wp-caption {
        text-align: center;
        padding: 10px;
            margin: 10px;
        background: none;
        }

如果您想要此处的页面示例,则为: http://www.metnews.org/news/aurora-remembers-holmes-victims/

谢谢,

【问题讨论】:

    标签: image css background border caption


    【解决方案1】:

    将图像的宽度以及使用的任何填充/边距相加,然后将文本的容器元素设置为相同的宽度。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-09
      • 2017-01-08
      • 2017-01-09
      • 1970-01-01
      • 2013-12-13
      • 2018-10-02
      相关资源
      最近更新 更多