Col-Sm对页面没有影响

Berkinakaydin

我在将桌面ui适应移动设备时遇到问题。当我从桌面设置col-md值时,组件会根据col-md的值调整大小,但是当我向这些相同的组件添加col-sm属性时,移动端将不会发生任何变化。

我正在使用Bootstrap 3

图片会更好地说明。

移动

桌面

<div id='main' class="container" ng-controller="searchController">
        <div class="row" id='tags'>
            <div class="col-md-3 col-sm-2" style="display:inline-block">
                <h4>Images</h4>
            </div>
            <div class="col-md-3 col-sm-2" style="display:inline-block">
                <h4>Name</h4>
            </div>
            <div class="col-md-2 col-sm-2" style="display:inline-block">
                <h4>Type</h4>
            </div>
            <div class="col-md-2 col-sm-2" style="display:inline-block">
                <h4>Price</h4>
            </div>
            <div class="col-md-1 col-sm-1" style="display:inline-block">
                <h4>Cart</h4>
            </div>
            <div class="col-md-1 col-sm-1" style="display:inline-block">
                <h4>Wishlist</h4>
            </div>

        </div>
        <hr>
        <div ng-repeat="result in results" ng-controller="buttonController">

            <div class="row">

                <div id='image' class="col-md-3 col-sm-3">
                    <img ng-src="{{result.image}}" style="max-width: 100%;max-height: 100%;">
                </div>

                <div class="col-md-3 col-sm-1">
                    <a ng-href='/product/{{result.id}}'>
                        <h3>{{result.name}}</h3>
                    </a>
                </div>
                <div class="col-md-2 col-sm-2" style="display:inline-block">
                    <h5 style="margin-top:30px">{{result.category}}</h5>
                </div>
                <div class="col-md-2 col-sm-2">
                    <h5 style="margin-top:30px">{{result.price}} {{result.currency}}</h5>
                </div>
                <div class="col-md-1 col-sm-1" style="display:inline-block">
                    <button ng-click='addBasket(result.id)' type="button" class="btn btn-default btn-sm" style="margin-top:30px">
                        <span class="glyphicon glyphicon-shopping-cart"></span>
                    </button>
                </div>

                <div class="col-md-1 col-sm-1" style="display:inline-block">
                    <button ng-click='addWishlist(result.id)' type="button" class="btn btn-default btn-sm" style="margin-top:30px">
                        <span class="glyphicon glyphicon-star"></span>
                    </button>
                </div>

            </div>

            <div class="col-md-6 alert alert-info ng-cloak" style="float: none;  margin: 0 auto;" ng-show="basketAlert">
                <strong>Confirm!</strong> This product has been added to your basket.
            </div>

            <div class="col-md-6  alert alert-info ng-cloak" style="float: none;  margin: 0 auto;" ng-show="wishlistAlert">
                <strong>Confirm!</strong> This product has been added to your wishlist.
            </div>

            <div class="col-md-6  alert alert-warning ng-cloak" style="float: none;  margin: 0 auto;" ng-show="alreadyInBasketAlert">
                <strong>Hey!</strong> This product is already in your basket.
            </div>

            <div class="col-md-6 alert alert-warning ng-cloak" style="float: none;  margin: 0 auto;" ng-show="alreadyInWishlistAlert">
                <strong>Hey!</strong> This product is already in your wishlist.
            </div>
            <hr>
        </div>

我不太擅长html页面。谢谢。

Dream_Cap

根据我在Bootstrap 3文档中看到的内容,您将要使用col-xs,因为您的定位移动设备(width <768px)。HTML看起来像这样。我用col-xs替换了col-sm。

<div id='main' class="container" ng-controller="searchController">
        <div class="row" id='tags'>
            <div class="col-md-3 col-xs-2" style="display:inline-block">
                <h4>Images</h4>
            </div>
            <div class="col-md-3 col-xs-2" style="display:inline-block">
                <h4>Name</h4>
            </div>
            <div class="col-md-2 col-xs-2" style="display:inline-block">
                <h4>Type</h4>
            </div>
            <div class="col-md-2 col-xs-2" style="display:inline-block">
                <h4>Price</h4>
            </div>
            <div class="col-md-1 col-xs-1" style="display:inline-block">
                <h4>Cart</h4>
            </div>
            <div class="col-md-1 col-xs-1" style="display:inline-block">
                <h4>Wishlist</h4>
            </div>

        </div>
        <hr>
        <div ng-repeat="result in results" ng-controller="buttonController">

            <div class="row">

                <div id='image' class="col-md-3 col-xs-3">
                    <img ng-src="{{result.image}}" style="max-width: 100%;max-height: 100%;">
                </div>

                <div class="col-md-3 col-xs-1">
                    <a ng-href='/product/{{result.id}}'>
                        <h3>{{result.name}}</h3>
                    </a>
                </div>
                <div class="col-md-2 col-sm-2" style="display:inline-block">
                    <h5 style="margin-top:30px">{{result.category}}</h5>
                </div>
                <div class="col-md-2 col-sm-2">
                    <h5 style="margin-top:30px">{{result.price}} {{result.currency}}</h5>
                </div>
                <div class="col-md-1 col-xs-1" style="display:inline-block">
                    <button ng-click='addBasket(result.id)' type="button" class="btn btn-default btn-sm" style="margin-top:30px">
                        <span class="glyphicon glyphicon-shopping-cart"></span>
                    </button>
                </div>

                <div class="col-md-1 col-xs-1" style="display:inline-block">
                    <button ng-click='addWishlist(result.id)' type="button" class="btn btn-default btn-sm" style="margin-top:30px">
                        <span class="glyphicon glyphicon-star"></span>
                    </button>
                </div>

            </div>

            <div class="col-md-6 alert alert-info ng-cloak" style="float: none;  margin: 0 auto;" ng-show="basketAlert">
                <strong>Confirm!</strong> This product has been added to your basket.
            </div>

            <div class="col-md-6  alert alert-info ng-cloak" style="float: none;  margin: 0 auto;" ng-show="wishlistAlert">
                <strong>Confirm!</strong> This product has been added to your wishlist.
            </div>

            <div class="col-md-6  alert alert-warning ng-cloak" style="float: none;  margin: 0 auto;" ng-show="alreadyInBasketAlert">
                <strong>Hey!</strong> This product is already in your basket.
            </div>

            <div class="col-md-6 alert alert-warning ng-cloak" style="float: none;  margin: 0 auto;" ng-show="alreadyInWishlistAlert">
                <strong>Hey!</strong> This product is already in your wishlist.
            </div>
            <hr>
        </div>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Bootstrap 4-与col-sm-12的col没有响应

为什么 col-sm-12 添加了 col-sm 在引导程序中没有的边距?

Bootstrap中的col-lg-*,col-md- *和col-sm- *有什么区别?

Bootstrap 3 col-sm-offset-x影响col-md-x结构

Angular 4 指令对页面加载没有影响

“ col-xs-12 col-sm-6 col-md-4 col-lg-3”和col-xs-12页面中心

Bootstrap 网格不适用于 codeply 或 devtools。<div class="col-lg-3 col-md-4 col-sm-6"> 的大小没有改变

在Bootstrap 3中使用col-*-12(col-xs / col-sm等)

带有图像的页面末尾的 Bootstrap col

如何在具有4个img的引导程序(col xs-12 col-sm-6 col-md-2 col-lg-2)中居中?

'DataFrame' 对象没有属性 'col' 错误

有没有办法通过 col-sm 知道用户是否正在使用类似于 flexbox 的小型设备?

如何使用 col-sm 内联?

ffmpeg strftime 对 Windows 没有影响

Modx phpthumbof对图像没有影响

IsConcurrencyToken() 对更新没有影响

显示 flex 没有影响 - ReactJS

类被添加,但没有影响

DataTable 对表格没有影响

角度-fxFlex对元素没有影响

Vcpkg对克隆的项目没有影响

jQuery对我的元素没有影响

fillMaxSize() 对 Scaffold 内容没有影响

Sequelize Setter 对更新没有影响

getStaticProps 的“notFound”属性对页面 http 状态码没有影响

django-为什么引导程序已经加载但对页面没有影响?

创建一个对页面上其他元素的定位没有影响的 div

使用的是<div class =“ col-sm-6”>还是<b-col sm =“ 6”>是否相同?

在col-sm-6内的Bootstrap 4 col-sm-6无法正常工作