【问题标题】:Materialize CSS: Change horizontal cards into vertical cards in mobileMaterialise CSS:在移动端将水平卡片变为垂直卡片
【发布时间】:2020-06-20 13:59:21
【问题描述】:

我有一张 Material Design 卡片,它最初在桌面视图中是水平的。问题是我在 card-content 中有大量文本。因此,在移动设备中,水平卡片左侧的图像仍然很小,而大文本会扩展卡片,这看起来很奇怪。

<div class="card horizontal">
    <div class="card-image">
      <img src="src/lib/svg/undraw_science_fqhl.png">
    </div>
    <div class="card-stacked">
      <div class="card-content">
       <p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.</p>
    </div>
    <div class="card-action">
     <a href="#">This is a link</a>
    </div>
  </div>
</div>

我想要的是让这个水平变成垂直卡 像这样在移动设备中:

我该如何解决这个问题?

【问题讨论】:

    标签: html css responsive-design materialize


    【解决方案1】:

    您需要在卡片上使用物化网格:

    以下是您的代码解决方案: Code

    Materialize card documentation

    <div class="row">
        <div class="col s12 m7">
            <div class="card">
                <div class="card-image">
                    <img src="images/sample-1.jpg">
                    <span class="card-title">Card Title</span>
                </div>
                <div class="card-content">
                    <p>I am a very simple card. I am good at containing small bits of information.
                    I am convenient because I require little markup to use effectively.</p>
                </div>
                <div class="card-action">
                    <a href="#">This is a link</a>
                </div>
            </div>
        </div>
    </div>
    
    

    【讨论】:

      猜你喜欢
      • 2021-06-17
      • 1970-01-01
      • 2015-10-24
      • 2020-11-10
      • 2016-10-02
      • 1970-01-01
      • 2018-02-19
      • 2019-02-25
      • 1970-01-01
      相关资源
      最近更新 更多