LoginSignup
6
4

More than 3 years have passed since last update.

vue.js 横スクロールメニュー を css だけで

Posted at

横スクロールメニューやりてぇ。
やり方わからねぇ。

あ、CSSでいけるかも。
↑正解!

hoge.css


    .horizontal-list {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }

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



Hoge.vue

        <h2>人気占い師</h2>

        <ul class="horizontal-list">
            <li>
                <div>
                    <img src="https://uranaibako.com/gcp_storage/photo_300x300_6515.jpg" class="icon-64" />
                </div>
            </li>
            <li>
                <div>
                    <img src="https://uranaibako.com/gcp_storage/photo_300x300_6515.jpg" class="icon-64" />
                </div>
            </li>
            <li>
                <div>
                    <img src="https://uranaibako.com/gcp_storage/photo_300x300_6515.jpg" class="icon-64" />
                </div>
            </li>
            <li>
                <div>
                    <img src="https://uranaibako.com/gcp_storage/photo_300x300_6515.jpg" class="icon-64" />
                </div>
            </li>
            <li>
                <div>
                    <img src="https://uranaibako.com/gcp_storage/photo_300x300_6515.jpg" class="icon-64" />
                </div>
            </li>
            <li>
                <div>
                    <img src="https://uranaibako.com/gcp_storage/photo_300x300_6515.jpg" class="icon-64" />
                </div>
            </li>
            <li>
                <div>
                    <img src="https://uranaibako.com/gcp_storage/photo_300x300_6515.jpg" class="icon-64" />
                </div>
            </li>
            <li>
                <div>
                    <img src="https://uranaibako.com/gcp_storage/photo_300x300_6515.jpg" class="icon-64" />
                </div>
            </li>
        </ul>


6
4
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
6
4