html - 如何在 ionicframework 中显示图像标题?

标签 html css responsive-design ionic-framework

<ion-view title="Categories">
                <ion-content ng-init="loadImages()">
                    <div id="catlist">
                        <div class="row" ng-repeat="image in images" ng-if="$index % 2 === 0">
                            <div class="col" ng-if="$index < images.length">
                                <a data-id="{{cats[$index].CategoryID}}" >
                                    <span id="Content" class="col col-25 ">{{cats[$index].CategoryName}}</span>
                                    <img ng-src="{{images[$index].src}}" width="100%" />
                                </a>
                            </div>
                            
                            <div class="col" ng-if="$index + 1 < images.length">
                                <a data-id="{{cats[$index+1].CategoryID}}" >
                                    <span id="Content" class="col col-25 ">{{cats[$index+1].CategoryName}}</span>
                                    <img ng-src="{{images[$index + 1].src}}" width="100%" />
                                </a>
                            </div>
                        </div>
                    </div>
                </ion-content>
            </ion-view>

#Content {
  background: rgba(0, 0, 0, 0.8) none repeat scroll 0 0;
  color: #f4f2f3;
  height: auto;
  position: absolute;
  text-align: center;
  width: 310px;
  text-decoration: none !important;
  background-opacity: 0.1;
  font-family: arial;
  font-size: 15px;
  font-weight: bold;
  -webkit-transition: 0.5s;
  -moz-transition: 0.5s;
  -o-transition: 0.5s;
  -ms-transition: 0.5s;
}

我已经创建了 2*2 图像网格并在图像顶部显示了图像标题。但是图像标题宽度不适合图像宽度。我正在使用 ionic 框架。如何根据图像宽度调整图像标题宽度? enter image description here

最佳答案

检查您的 css 以获取 #Content(这应该更改为类而不是 id,因为它假设每页一个 id 只有一个元素。但我不认为这就是问题发生的原因)

在您的#Content 样式中,您能否尝试更改

width: 310px;

width: 100%;

如果不行,尝试添加

display: block;

希望这有帮助,对不起我的英语:)

关于html - 如何在 ionicframework 中显示图像标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30723502/

相关文章:

javascript - 更改菜单打开和关闭时的文本

php - css协助绘制季后赛括号

html - 响应式固定位置侧div

css - 响应式等宽

css - 3 垂直剖面

javascript - HTML 5 工具

javascript - 通过#链接弹出窗口,如何在关闭时删除网址中的#?

android - 为什么 webkit 浏览器会缩小手机上的一些 float 元素?

html - CSS 按钮未正确对齐

jquery - 想让我的图表在 D3 中看起来响应