我如何定位此文本&确保用户屏幕在打开我的网站时调整到80%?

时间:2017-03-15 17:37:41

标签: html css

Q1

如何将文本array_keys | array_values置于导航栏文本的中心位置?这是一个example橙色框,是我希望放置文本的地方。

Q2 我还想知道如何在打开我的网站时强制用户屏幕将视图调整为80%?原因是由于100%使某些事情看起来不正确。例如,我调用的第1部分背景图像是大小不合适的。 `

HTML

<h1>Welcome to Liam Docherty's Digital Portfolio</h1>

CSS

<!DOCTYPE html>
<html>
<head>
    <html lang="en">
    <meta charset="UTF-8">
    <title>Liam Docherty Digital Portfolio</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
</head>
 <body>
        <nav class="navbar navbar-default navbar-fixed-top"> 
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#"><img src="http://placehold.it/60x60" alt="Your Brand Name"></a>
                    <h1 class="nav-title">Liam Docherty's Digital Portfolio</h1>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                            <li><a href="#">Home</a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">About Me <span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">Action</a>
                                    </li>
                                    <li><a href="#section3">Contact</a>
                                    </li>
                                    <li><a href="#">Something else here</a>
                                    </li>
                                    <li><a href="#">Separated link</a>
                                    </li>
                                    <li><a href="#">One more separated link</a>
                                    </li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Units <span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">Action</a>
                                    </li>
                                    <li><a href="#">Another action</a>
                                    </li>
                                    <li><a href="#">Something else here</a>
                                    </li>

                                    <li><a href="#">Separated link</a>
                                    </li>

                                    <li><a href="#">One more separated link</a>
                                    </li>
                                </ul>
                            </li>
                            <li><a href="#">Clients</a>
                            </li>
                            <li><a href="#contact-me">Contact Me</a>
                            </li>
                        </ul>
                      </div><!-- /.navbar-collapse -->
                    </div><!-- /.container-fluid -->
        </nav>


    <section id="section1" class="section1">
      <div class="hero"></div>


      <a href="#section2"><i class="fa fa-angle-down" style="font-size:100px;"></i></a>

    </section>
    <section id="section2" class="section2">


      <a href="#contact-me"> <i class="fa fa-angle-down" style="font-size:100px;"></i></a>

    </section>

    <section id="contact-me" class="contact_section section3">

      <a href="#section1"> <i class="fa fa-angle-up" style="font-size:100px;"></i></a>

    </section>
    <script   src="https://code.jquery.com/jquery-3.1.1.js" integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA="   crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<footer>
    <div class="page">
        <h1 class="footer">Copyright © 2017 Liam Docherty's Site. All rights reserved.</h1>
    </div>
 </footer>     
</body>
</html>

1 个答案:

答案 0 :(得分:0)

如果没有要编辑的实时版本,那很难 第一季度: 在文本周围添加一个div

<div class="centertext">
                    <h1 class="nav-title">Liam Docherty's Digital Portfolio</h1>
</div>

然后添加css

.centertext {
  width: 100%;
  position: absolute;
}

对于Q2,我不太确定你在谈论什么,但是如果只是图像没有正确的尺寸,那么通过css而不是缩小来调整它们的尺寸会更好。 尝试添加css选项,例如background-size:contains;或背景大小:封面;

让我知道这是否有效