html - 我无法按下按钮,当我将它们居中时选择框(文本对齐 : center;)

标签 html css

我有一个 div 类,包含按钮、选择框和输入文本(在我所有的 jsp 文件中共享为一个 div),我在其中设置了 css 样式(文本对齐:居中);

当这个 div 左对齐时,我可以按下并输入所有这些。

这是我包含的jsp文件http://scratchpad.io/first-protest-1771

如果我不包括整个代码,无论我如何对齐它们,我的 div 都可以正常工作。

谁能告诉我,这是怎么回事?

最佳答案

您可以使用此代码

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="javascript/lib/jquery-1.11.0.js"></script>
    <title>eBanking</title>
    <link rel="stylesheet" href="style.css">
        <style type="text/css">
        @media print {
            .example-screen {
                display: none;
            }
            .example-print {
                display: block;
            }
        }
        .extraCont {
            color: white;
        }
        td {
            /*   text-align: center; */
        }
        footer {
            position: fixed;
            left: 0;
            bottom: 0;
            width: 100%;
            background-color: red;
            color: white;
            text-align: center;
        }
        body {
            margin: 0;
            padding: 0;
            background: url(bg.jpg) no-repeat;
            background-size: cover;
            font-family: Arial;
        }
        .loginBox {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 350px;
            height: 420px;
            padding: 80px 40px;
            box-sizing: border-box;
            background: rgba(0, 0, 0, .5);
        }
        h2 {
            margin: 0;
            padding: 0 0 20px;
            color: #efed40;
            text-align: center;
        }
        h3 {
            color: #efed40;
        }
        h1 {
            color: #efed40;
            text-align: center;
        }
        .loginBox p {
            margin: 0;
            padding: 0;
            font-weight: bold;
            color: #fff;
        }
        .loginBox input {
            width: 100%;
            margin-bottom: 20px;
        }
        .loginBox input[type="text"],
        .loginBox input[type="password"] {
            border: none;
            border-bottom: 1px solid #fff;
            background: transparent;
            outline: none;
            height: 40px;
            color: #fff;
            font-size: 16px;
        }
        ::placeholder {
            color: rgba(255, 255, 255, .5);
        }
        .loginBox input[type="submit"] {
            border: none;
            outline: none;
            height: 40px;
            color: #fff;
            font-size: 16px;
            background: #ff267e;
            cursor: pointer;
            border-radius: 20px;
        }
        .loginBox input[type="submit"]:hover {
            background: #efed40;
            color: #262626;
        }
        .loginBox a {
            color: #fff;
            font-size: 14px;
            font-weight: bold;
            text-decoration: none;
        }
        .menuBox ul {
            margin: 0 auto;
            padding: 0px;
            list-style: none;
            text-align: center;
        }
        .menuBox ul li {
            float: left;
            width: 210px;
            height: 40px;
            background-color: black;
            color: white;
            opacity: .8;
            line-height: 40px;
            text-align: center;
            font-size: 20px;
            margin-right: 25px;
        }
        .menuBox ul li a {
            text-decoration: none;
            color: white;
            display: block;
            padding: 0px 15px;
        }
        .menuBox ul li a:hover {
            background-color: green;
        }
        .menuBox .menuboxli {
            text-align: center;
            margin: 0 auto;
            display: inline-block;
            vertical-align: middle;
            float: none;
        }
                ul li ul li {
            display: none;
        }
        ul li:hover ul li {
            display: block;
        }
        .sanBox {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 600px;
            height: 500px;
            padding: 80px 40px;
            box-sizing: border-box;
            background: rgba(0, 0, 0, .5);
        }
        .menuBox {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 870px;
            height: 500px;
            padding: 80px 40px;
            /*  box-sizing: border-box; */
            /*  background: rgba(0,0,0,.5)  ; */
        }
        .mapBox {
            position: absolute;
            top: 60%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 1280px;
            height: 600px;
            padding: 80px 40px;
            box-sizing: border-box;
            background: rgba(0, 0, 0, .5);
        }
        .user {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            overflow: hidden;
            position: absolute;
            top: calc(-100px/2);
            left: calc(50% - 50px);
        }
        .menuRight ul {
            list-style-type: none;
            margin: 0;
            padding: 10px;
            overflow: hidden;
        }
        .menuRight li {
            float: right;
        }
        .menuRight li a {
            display: inline-block;
            color: white;
            text-align: center;
            padding: 14px 16px;
            text-decoration: none;
        }
        .vizCont {
            margin-top: 120px;
            text-align: center;
        }
        .white {
            color: white;
        }
        #renunta {}
        #renunta a {
            color: #fff;
            font-size: 14px;
            font-weight: bold;
            text-decoration: none;
        }    
    </style>
</head>
<body>
    <div class="menuRight">
        <ul>
            <li><a href="logout.jsp">Logout</a></li>
        </ul>
    </div>
    <div class="menuBox">
        <h1>eBanking</h1>
        <ul>
            <li class="menuboxli"><a>CONTURIffgfdfg</a>
                <ul>
                    <li><a href="administrareCont.jsp">AdministrareCont</a></li>
                    <li><a href="vizualizareCont.jsp">VizualizareCont</a></li>
                </ul>
            </li>
            <li class="menuboxli"><a>OPERATII</a>
                <ul>
                    <li><a href="transfer.jsp">Transfer</a></li>
                    <li><a href="alimentareCont.jsp">OperatiiInCurs</a></li>
                </ul>
            </li>
            <li class="menuboxli"><a>RAPOARTE</a>
                <ul>
                    <li><a href="extraCont.jsp">ExtraCONT</a></li>
                </ul>
            </li>
            <li class="menuboxli"><a href="aprobare.jsp">APROBARE</a></li>
        </ul>
    </div>
    <footer> Tomuta Dan Claudiu dannyetlv @2019 </footer>
</body>
</html>

关于html - 我无法按下按钮,当我将它们居中时选择框(文本对齐 : center;),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55266744/

相关文章:

javascript - 使用有限的列表项滚动 - 没有 jquery

javascript - jquery:下拉菜单不显示固定位置 div 顶部的边框样式

javascript - 获取 div 内的子元素? javascript

javascript - ng 风格间歇性工作

html - Position 固定元素导致整个页面重绘/重绘

html - div 在小屏幕上消失

html - 单击表单提交按钮时触发远程引导模态,然后远程模态内容具有要显示的表单数据?

css - jQuery slider 后面出现的 CSS 下拉菜单的 Z-index 问题

html - 为什么提交按钮位于 textarea 字段之上?

html - 如何超链接 CSS 制作的图像?