为什么bootstrap没有显示我的一些元素?

时间:2016-07-27 14:20:47

标签: php html css twitter-bootstrap

我正在使用我在互联网上找到的自定义主题进行引导。当我添加一个新的" Row"对于我的网格系统,事情变得有些混乱, 我不确定我做错了什么,但我确实相信是样式问题,因为它似乎没有显示我想要它显示的内容所以当我加载页面时我看到以下

如果您需要更多信息以便能够帮助我,我很乐意给予它 Pic example 1

和浏览器上的滚动条(允许您向下滚动)

通过这样做一秒钟你可以看到其他应该是这样的

pic example 2

但是它解散了,我会分享我的代码,如果有人可以帮助我,我不是一个经验丰富的prgoramer但我想到达那里。 这是viewHero.php的代码

<?php session_start(); 
//error_reporting(0);
//ini_set('display_errors', 0);
?>
<!doctype html>
<html lang="en"  >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" >
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">     



    <link rel="stylesheet" href="style/reset.css"> <!-- CSS reset -->
    <link rel="stylesheet" href="style/style.css"> <!-- Resource style -->
    <script src="js/modernizr.js"></script> <!-- Modernizr -->

    <title>Overblog</title>
</head>
<body >
    <header class="cd-main-header">
        <a href="#0" class="cd-logo"><img src="img/cd-logo.svg" alt="Logo"></a>

        <div class="cd-search is-hidden">
            <form action="#0">
                <input type="search" placeholder="Search...">
            </form>
        </div> <!-- cd-search -->

        <a href="#0" class="cd-nav-trigger">Menu<span></span></a>

        <nav class="cd-nav">
            <ul class="cd-top-nav">

                <li class="has-children account">

                    <ul>


                    </ul>
                </li>
            </ul>
        </nav>
    </header> <!-- .cd-main-header -->

    <main class="cd-main-content">
        <nav class="cd-side-nav">
            <ul>
                <li class="cd-label">Main</li>
                <li class="has-children overview">
                    <a href="#0">Blog</a>

                    <ul>
                        <li><a href="#0">Latest news</a></li>
                        <li><a href="#0">Public Test Region</a></li>
                        <li><a href="#0">RedPost (Redit)</a></li>
                    </ul>
                </li>
                <li class="has-children notifications active">


                <li class="has-children comments">
                    <a href="#0">Guides</a>

                </li>

                <li class="has-children users">
                    <a href="#0">Hereos</a>

                </li>

            </ul>

        </nav>

    <style>

body
{
    font-family: 'Open Sans', sans-serif;
}

.fb-profile img.fb-image-lg{
    z-index: 0;
    width: 100%;  
    margin-bottom: 10px;
}

.fb-image-profile
{
    margin: -90px 10px 0px 50px;
    z-index: 9;
    width: 20%; 
}

@media (max-width:768px)
{

.fb-profile-text>h1{
    font-weight: 700;
    font-size:16px;
}

.fb-image-profile
{
    margin: -45px 10px 0px 25px;
    z-index: 9;
    width: 20%; 
}
}
 h2{font-size:40px;
        }
        </style>     
    <div class="content-wrapper">
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<div class="container">
     <div class="row">                  
    <?php 
//show users code.
           define('SITE_ROOT', dirname(__FILE__));
echo "<br/>";
                require SITE_ROOT . '\includes\loadHeroProfile.php';
    ?>
    </div>
 <div class="row"> 
      <div class='col-lg-4'>
<ul class="list-group">
  <li class="list-group-item">Cras justo odio</li>
  <li class="list-group-item">Dapibus ac facilisis in</li>
  <li class="list-group-item">Morbi leo risus</li>
  <li class="list-group-item">Porta ac consectetur ac</li>
  <li class="list-group-item">Vestibulum at eros</li>
</ul>
     </div>

    </div>
</div> <!-- /container -->  

        </div>

    </main> <!-- .cd-main-content -->
<script src="scripts/jquery-2.1.4.js"></script>
<script src="scripts/jquery.menu-aim.js"></script>
<script src="scripts/main.js"></script> <!-- Resource jQuery -->
</body>
</html>

这是loadHeroProfile.php

<?php 
//show users code.


require SITE_ROOT . '\includes\db_connect.php';
//create connection and check it
 global $connect;
$ids = intval($_GET['ids']);

$result = $conn->prepare("SELECT id,nickname,avatar,name,age,occupation,operations,affiliation,difficulty,ability,tips,story FROM heroes WHERE id=$ids");
$result->execute(); 
 while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
    $id = $row["id"];
    $nickname = $row["nickname"];
    $avatar = $row["avatar"];
    $name = $row["name"];
    $age = $row["age"];
    $occ = $row["occupation"];
    $opp = $row["operations"];
    $aff = $row["affiliation"];
    $diff = $row["difficulty"];
    $ability = $row["ability"];
    $tips = $row["tips"];
    $story = $row["story"];

    $avatar =  "./img/" . $avatar;
  echo "   <div class='fb-profile'> ";
  echo "    <img align='left' class='fb-image-lg' src='./img/Untitled.png' alt='Profile image example'/>  ";
  echo "    <img align='left' class='fb-image-profile thumbnail' src=". $avatar ." alt='Profile image example' />  ";
  echo "        <div class='fb-profile-text'>  ";
  echo "            <h2>" . $nickname . "</h2><br/>  ";
  echo "            <p>" . $name . "</p>  ";
  echo "       </div>  ";
  echo "  </div>  ";

  }
?>

我该怎么做才能解决这个问题?  编辑最终的HTML代码:

<!doctype html>
<html lang="en"  >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" >
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">     



    <link rel="stylesheet" href="style/reset.css"> <!-- CSS reset -->
    <link rel="stylesheet" href="style/style.css"> <!-- Resource style -->
    <script src="js/modernizr.js"></script> <!-- Modernizr -->

    <title>Overblog</title>
</head>
<body >
    <header class="cd-main-header">
        <a href="#0" class="cd-logo"><img src="img/cd-logo.svg" alt="Logo"></a>

        <div class="cd-search is-hidden">
            <form action="#0">
                <input type="search" placeholder="Search...">
            </form>
        </div> <!-- cd-search -->

        <a href="#0" class="cd-nav-trigger">Menu<span></span></a>

        <nav class="cd-nav">
            <ul class="cd-top-nav">

                <li class="has-children account">

                    <ul>


                    </ul>
                </li>
            </ul>
        </nav>
    </header> <!-- .cd-main-header -->

    <main class="cd-main-content">
        <nav class="cd-side-nav">
            <ul>
                <li class="cd-label">Main</li>
                <li class="has-children overview">
                    <a href="#0">Blog</a>

                    <ul>
                        <li><a href="#0">Latest news</a></li>
                        <li><a href="#0">Public Test Region</a></li>
                        <li><a href="#0">RedPost (Redit)</a></li>
                    </ul>
                </li>
                <li class="has-children notifications active">


                <li class="has-children comments">
                    <a href="#0">Guides</a>

                </li>

                <li class="has-children users">
                    <a href="#0">Hereos</a>

                </li>

            </ul>

        </nav>

    <style>

body
{
    font-family: 'Open Sans', sans-serif;
}

.fb-profile img.fb-image-lg{
    z-index: 0;
    width: 100%;  
    margin-bottom: 10px;
}

.fb-image-profile
{
    margin: -90px 10px 0px 50px;
    z-index: 9;
    width: 20%; 
}

@media (max-width:768px)
{

.fb-profile-text>h1{
    font-weight: 700;
    font-size:16px;
}

.fb-image-profile
{
    margin: -45px 10px 0px 25px;
    z-index: 9;
    width: 20%; 
}
}
 h2{font-size:40px;
        }
        </style>     
    <div class="content-wrapper">
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<div class="container">
     <div class="row">                  
    <br/>    <div class='fb-profile'>     <img align='left' class='fb-image-lg' src='./img/Untitled.png' alt='Profile image example'/>      <img align='left' class='fb-image-profile thumbnail' src=./img/bastion.png alt='Profile image example' />          <div class='fb-profile-text'>              <h2>Bastion</h2><br/>              <p>SST Laboratories Siege Automaton E54, "Bastion"</p>         </div>    </div>      </div>
 <div class="row"> 
      <div class='col-lg-4'>
<ul class="list-group">
  <li class="list-group-item">Cras justo odio</li>
  <li class="list-group-item">Dapibus ac facilisis in</li>
  <li class="list-group-item">Morbi leo risus</li>
  <li class="list-group-item">Porta ac consectetur ac</li>
  <li class="list-group-item">Vestibulum at eros</li>
</ul>
     </div>

    </div>
</div> <!-- /container -->  

        </div>

    </main> <!-- .cd-main-content -->
<script src="scripts/jquery-2.1.4.js"></script>
<script src="scripts/jquery.menu-aim.js"></script>
<script src="scripts/main.js"></script> <!-- Resource jQuery -->
</body>
</html>

按要求编辑样式: 请注意,我没有制作或触摸这个,是一个免费的临时互联网 reset.css

    /* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section, main {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

Style.css找到它here

我无法发布此内容,因为它会通过3k标记发布。

1 个答案:

答案 0 :(得分:1)

您提供的HTML充满了错误和不一致之处;我强烈建议您查看模板提供的代码,以确保这些错误不会导致意外的渲染问题。

话虽如此,我在这里创建了一个展示更正HTML的JSFiddle:

https://jsfiddle.net/embed/1pfz7yg2/show/

您可以在此处查看HTML / CSS:https://jsfiddle.net/embed/1pfz7yg2/

根据我对您所需输出的理解,您希望左侧导航保持静态。既然如此,CSS的最相关部分是:

from django import forms class SignupForm(forms.Form): first_name = forms.CharField(max_length=30, label='Voornaam') last_name = forms.CharField(max_length=30, label='Achternaam') organisation = forms.CharField(max_length=20, label='organisation') def signup(self, request, user): user.first_name = self.cleaned_data['first_name'] user.last_name = self.cleaned_data['last_name'] # Replace 'profile' below with the related_name on the OneToOneField linking back to the User model up = user.profile up.organisation = self.cleaned_data['organisation'] user.save() up.save()