Html CSS宽度:100%不适用于Google Chrome

Html CSS宽度:100%不适用于Google Chrome,html,css,google-chrome,width,figure,Html,Css,Google Chrome,Width,Figure,我正试图建立画廊部分与标题的基础上的数字和figcaptions。 它必须具有响应能力,并能在不同的高度/宽度下工作 firefox中的一切都很好,但不幸的是chrome没有遵循CSS中的100%宽度,这一点很重要 figure { margin: 6px; color: #333; /*display: table; float: left;*/ display: inline-block; -webkit-box-sizing: border-box ; -moz

我正试图建立画廊部分与标题的基础上的数字和figcaptions。 它必须具有响应能力,并能在不同的高度/宽度下工作

firefox中的一切都很好,但不幸的是chrome没有遵循CSS中的100%宽度,这一点很重要

figure {
  margin: 6px;
  color: #333;
  /*display: table;
  float: left;*/
  display: inline-block;
  -webkit-box-sizing: border-box ;
  -moz-box-sizing: border-box ;
   box-sizing: border-box ;

}
figure figcaption {
  background: #E3E3E3;
  padding: 10px 12px 12px;
  color: #333;
  text-align: center;
  font-size: 13px;
  width: 100%;
  display: table-caption;
  caption-side: bottom;
  -webkit-box-sizing: border-box ;
  -moz-box-sizing: border-box ;
  box-sizing: border-box ;
}
这是我的


请帮助。

将宽度:100%更改为宽度:300px;它将同时支持这两种功能。

请参见下面的fiddle: 适用于chrome和Mozilla

我在图中添加了display:table,并从图标题中删除了width:100%

figure {
    margin: 6px;
    color: #333;
    /*display: table;
    float: left;*/
    -webkit-box-sizing: border-box ;
    -moz-box-sizing: border-box ;
    box-sizing: border-box ;
    display:table;
 }
figure figcaption {
    background: #E3E3E3;
    padding: 10px 12px 12px;
    color: #333;
    text-align: center;
    font-size: 13px;
    display: table-caption;
    caption-side: bottom;
    -webkit-box-sizing: border-box ;
    -moz-box-sizing: border-box ;
    box-sizing: border-box ;
}

此解决方案可能会很好地工作,除非您必须插入并具有某种固定宽度或最大宽度

身材{ 利润率:6px; 最大宽度:300px; 颜色:333; 显示:内联块; -webkit框大小:边框框; -moz框大小:边框框; 框大小:边框框; } 图figcaption{ 背景:E3; 填充:10px 12px 12px; 颜色:333; 文本对齐:居中; 字体大小:13px; 宽度:100%; 显示:表格标题; 标题侧:底部; -webkit框大小:边框框; -moz框大小:边框框; 框大小:边框框; } 图形分割{ 显示器:flex; 弯曲方向:立柱; } 知识是一种美德,是一种美德,是一种美德,是一种美德。但是,我们必须尽可能少地进行实验,因为我们的实验室是不合格的 Lorem ipsum dolor sit amet,是一位杰出的建筑设计师,他在工作和生活中的临时收入与生活水平相当。但是,我们必须尽可能少地进行实验,因为我们的实验室是不合格的 Lorem ipsum dolor sit amet,是一位杰出的领导者,他是一位临时劳工和职业经理人。但最低限度为绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品 知识是一种美德,是一种美德,是一种美德,是一种美德。但是,作为一个数据,我们需要一个最低限度的数据,由ullamco实验室提供 Lorem ipsum dolor sit amet,是一位杰出的建筑设计师,他在工作和生活中的临时收入与生活水平相当。但是,我们必须尽可能少地进行实验,因为我们的实验室是不合格的 Lorem ipsum dolor sit amet,是一位杰出的领导者,他是一位临时劳工和职业经理人。但最低限度为绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品、绿色食品
将每个图形元素放入figurebox元素中。 将figurebox.display设置为inline block和valign top 将figure.display设置为浮动左表。在你的评论之后

figurebox {
  display: inline-block;
  vertical-align: top;
}

figure {
  display: table;
  float: left;
}

<figurebox>
  <figure>
    <img src="http://imgsv.imaging.nikon.com/lineup/dslr/d800/img/sample01/img_01.png" >
    <figcaption>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex asl;lf kasdfkla ;lsl sf;la dsfhasfqw qw eiiwyq uoqw ruiq qeiwory qwoeroqewr uiqw ryqwerqew rqew rqwe rqewr qwer qwe qew r qwer qwe rqwer qwer 
    </figcaption>
  </figure>
</figurebox>
请参见更新的示例

使用显示:内联表格查看图形,并从figcaption中删除宽度:100%

这是一个在Chrome和Firefox中都能工作的例子


它必须负责,并且图像可以具有不同的大小宽度:100%不适用于显示:表格标题。使显示为:块或表。@locateganesh-但是图库应该是内联对齐的…然后您可以用像素表示,或者编写jquery代码,如addfigure-figcaption{display:block}几乎-图像应该对齐到顶部。解决方案是好的,但如果没有额外的html代码会更好。请显示此figurebox元素的引用…我不确定它是否存在。
figure {
    margin: 6px;
    color: #333;
    display: inline-table;  /*changed to inline-table*/
    -webkit-box-sizing: border-box ;
    -moz-box-sizing: border-box ;
     box-sizing: border-box ;
}

figure figcaption {
    background: #E3E3E3;
    padding: 10px 12px 12px;
    color: #333;
    text-align: center;
    font-size: 13px;
    /*  width:100%;   */
    display: table-caption;
    caption-side: bottom;
    -webkit-box-sizing: border-box ;
    -moz-box-sizing: border-box ;
    box-sizing: border-box ;
}