LoginSignup
1
3

More than 3 years have passed since last update.

横スクロール カード素材 css

Last updated at Posted at 2019-08-15

横スクロールしたいやん。
で、カード的なデザインにしたいやん。
cssでできるやん。

コピペで動くよ。

sytle.css

    /* 横スクロールカード素材 */
    .card-horizontal-list {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: 0 0 0 10px;
    }

    .card-horizontal-list li {
        /* 横スクロール用 */
        display: inline-block;
    }

    .card-horizontal-list li > a {
        margin: 5px;
        width: 150px;
        background: #fff;
        border-radius: 5px;
        box-shadow: 0 2px 5px #ccc;
        display: inline-block;
    }
    .card-horizontal-list li > a > img {
        border-radius: 5px 5px 0 0;
        /*max-width: 100%;*/
        /*height: auto;*/

        object-fit: cover;
        height: 102px !important;
        width: 150px !important;
    }
    .card-horizontal-list li > a > div {
        padding: 15px;
    }
    .card-horizontal-list li > a > div > h3 {
        font-size: 12px;
        text-align: center;
        margin-top: 0;
        padding-top: 0;
        color: #333;
    }
    .card-horizontal-list li > a > div > p {
        color: #777;
        font-size: 10px;
        line-height: 1.5;
        word-wrap: break-word;
        white-space: normal;
    }

カードhtml



        <ul class="card-horizontal-list">
            <li>
                <a v-touch="$root.linkTo('/contact-show/')">
                    <img src="http://webcreatorbox.com/sample/images/bear.jpg">
                    <div>
                        <h3>Web</h3>
                        <p>ラーメン</p>
                    </div>
                </a>
            </li>
            <li>
                <a v-touch="$root.linkTo('/contact-show/')">
                    <img src="http://webcreatorbox.com/sample/images/bear.jpg">
                    <div>
                        <h3>Web</h3>
                        <p>ラーメン</p>
                    </div>
                </a>
            </li>
            <li>

                <a v-touch="$root.linkTo('/contact-show/')">
                    <img src="http://webcreatorbox.com/sample/images/bear.jpg">
                    <div>
                        <h3>Web</h3>
                        <p>ラーメン</p>
                    </div>
                </a>

            </li>
        </ul>



1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3