Boostrap / CSS / Javascript / PHP:如何将列表显示为lg屏幕的3列和sm屏幕的1列

问题描述 投票:0回答:1

在计算机上,我的列表如下:enter image description here

但是在电话上,它仅显示第一列,并且不会以1列列表的形式继续显示该列表。

我正在使用Bootstrap,代码如下:

 <section>
        <div class="container">
            <div class="row align-items-start">
                <div class="col-sm-12 col-md-4">
                    <div class="p-3">

                        <b>Statewide Texas Sites</b><br />
                        <a href="https://www.touringtexas.com/" target="_top">Touring Texas</a>
                        <br />
                        <a href="https://www.texas-lakes.net/" target="_top">Texas Lakes</a>
                        <br />

                    </div>
                </div>

                <div class="col-sm-12 col-md-4 col-md-push-4">
                    <div class="p-3">

                        <b>Texas Tourist Areas</b><br />
                        <a href="https://www.highlandlakes.com/" target="_top">Highland Lakes</a>
                        <br />
                        <a href="https://www.hill-country.net/" target="_top">Hill Country Network</a>
                        <br />

                    </div>
                </div>


                <div class="col-sm-12 col-md-4 col-md-push-4">
                    <div class="p-3">

                        <b>Texas Lakes</b><br />
                        <a href="https://www.highlandlakes.net/lakeaustin/" target="_top">Lake Austin</a>
                        <br />
                        <a href="https://www.lake-bridgeport.com/" target="_top">Lake Bridgeport</a>
                        <br />

                    </div>
                </div>
            </div>
        </div>
    </section>

感谢您的帮助!

javascript css size screen
1个回答
0
投票

应该工作正常,看起来您的设置有问题,首先我可以认为是视口,请检查您的头中是否有<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

请参阅在手机和办公桌上工作的示例。

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="/docs/4.1/assets/img/favicons/favicon.ico">

    <title>Sticky Footer Template for Bootstrap</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<body>
<section>
<div class="container">
<div class="row align-items-start">
	<div class="col-sm-12 col-md-4">
		<div class="p-3">

			<b>Statewide Texas Sites</b><br />
			<a href="https://www.touringtexas.com/" target="_top">Touring Texas</a>
			<br />
			<a href="https://www.texas-lakes.net/" target="_top">Texas Lakes</a>
			<br />

		</div>
	</div>

	<div class="col-sm-12 col-md-4 col-md-push-4">
		<div class="p-3">

			<b>Texas Tourist Areas</b><br />
			<a href="https://www.highlandlakes.com/" target="_top">Highland Lakes</a>
			<br />
			<a href="https://www.hill-country.net/" target="_top">Hill Country Network</a>
			<br />

		</div>
	</div>


	<div class="col-sm-12 col-md-4 col-md-push-4">
		<div class="p-3">

			<b>Texas Lakes</b><br />
			<a href="https://www.highlandlakes.net/lakeaustin/" target="_top">Lake Austin</a>
			<br />
			<a href="https://www.lake-bridgeport.com/" target="_top">Lake Bridgeport</a>
			<br />

		</div>
	</div>
</div>
</div>
</section>
	
  </body>
</html>
© www.soinside.com 2019 - 2024. All rights reserved.