如何在yii2中使弹出窗口水平滚动

oknwwptz  于 2022-11-09  发布在  其他
关注(0)|答案(1)|浏览(118)

我在yii 2的布局中有这个弹出窗口部分。它在需要的时候自然向下滚动,但不是水平滚动。我怎样才能使它水平滚动呢?

<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\widgets\Alert;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <title><?= Html::encode($this->title) ?></title>
     <!-- Tell the browser to be responsive to screen width -->
     <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
     <link rel="icon" href="images/favicon.ico" type="image/x-icon" />
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>

    <!-- Create modal -->

        <!-- <div class="modal-body"> -->

                <?= $content ?>

        <!-- </div> -->

<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

此弹出窗口包含在web/themes/default/views/layout中

jmp7cifd

jmp7cifd1#

我的工作正常,使用***overflow-y:滚动;***在情态主体div之后

<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\widgets\Alert;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <title><?= Html::encode($this->title) ?></title>
     <!-- Tell the browser to be responsive to screen width -->
     <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
     <link rel="icon" href="images/favicon.ico" type="image/x-icon" />
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>

    <!-- Create modal -->

        <!-- <div class="modal-body"> -->
            <div style ="overflow-y: scroll;">
                <?= $content ?>
            </div>
        <!-- </div> -->

<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

相关问题