-1

我正在为以下图像设计一个使用引导响应的页面,而我是使用引导响应的初学者。create_account.png 用于 create_account 页面

html如下。

<!DOCTYPE HTML>

<html>

<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="" />
<meta charset="utf-8">
<title>Bootstrap Responsive</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="" name="description">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<style>
    .container {
        margin-top: 80px;
    }
    #main-form {
        margin: auto;
        width:  500px;
    }
    .profile-photo {
        vertical-align: middle;
    }
    .form {
        text-align: center;
    }
    .profile-image {
        width: 100%;
        height: 100%;
    }
</style>

<body>
    <div class="container">
        <div class="row text-center">
            <img src="img/slider/1.jpg" width="250px" height="250px" />
        </div>
        <div class="row text-center">
            <h2>Create your account</h2>
        </div>
        <div class="row">
            <div id="main-form">
                <div class="span2">
                    <div class="profile-photo">
                        <img class="profile-image" src="img/slider/1.jpg" />
                    </div>
                </div>
                <div class="span3 form">
                      <div class="widget-container widget-box4">  
                        <div class="control-group">
                            <div class="controls">
                                <input type="text" id="inputEmail" placeholder="Username">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <input type="text" id="inputEmail" placeholder="Email">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <input type="password" id="inputPassword" placeholder="Password">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <input type="password" id="inputPassword" placeholder="Confirm Password">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <input type="checkbox"> Remember me
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <button type="submit" class="btn">Sign in</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="js/bootstrap.min.js">
    <script type="text/javascript">
        $('.carousel').carousel();
    </script>
</body>

我想要它在页面中间,我在桌面中得到了正确的。

但问题是表格和个人资料图像不在中心。

请帮我怎么做?

作品更受赞赏。

4

1 回答 1

-1

我已经对您的代码进行了更改,请注意,对于手机布局可能小于 500 像素,您已经提到了您的容器之一,因此您的手机布局会受到干扰,请尝试对其使用自定义媒体查询,就 html 结构而言,请查看变化...

<body>
    <div class="container">
        <div class="row text-center">
            <img src="img/slider/1.jpg" width="250px" height="250px" />
        </div>
        <div class="row text-center">
            <h2>Create your account</h2>
        </div>
            <div id="main-form" class="row">
                <div class="span5">
                    <div class="profile-photo">
                        <img class="profile-image" src="img/slider/1.jpg" />
                    </div>
                </div>
                <div class="span7 form">
                      <div class="widget-container widget-box4">  
                        <div class="control-group">
                            <div class="controls">
                                <input type="text" id="inputEmail" placeholder="Username">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <input type="text" id="inputEmail" placeholder="Email">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <input type="password" id="inputPassword" placeholder="Password">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <input type="password" id="inputPassword" placeholder="Confirm Password">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <input type="checkbox"> Remember me
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <button type="submit" class="btn">Sign in</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
    </div>

    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $('.carousel').carousel();
    </script>
</body>
于 2013-03-26T07:47:57.347 回答