导航栏中的Bootstrap图片

时间:2016-04-29 16:26:32

标签: html css twitter-bootstrap

我想要使用的图片有问题而不是彩色背景。

但由于某种原因,它只是给了我一个纯白色的背景。

我似乎无法找到错误,但我仍会尝试。我希望有人可以帮我解决这个问题,因为我还在学习HTML,CSS& PHP正确!

CODE:



<?php
// CSS Fil:





?>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

<!-- Jquery css -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">

<!-- Fontawesome.io CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

<style>
	html {
	  position: relative;
	  min-height: 100%;
	}
	body {
	  /* Margin bottom by footer height */
	  margin-bottom: 60px;
	}
	.footer {
	  position: absolute;
	  bottom: 0;
	  width: 100%;
	  /* Set the fixed height of the footer here */
	  height: 60px;
	  background-color: #f5f5f5;
	}
	

	
	body {
    background-image: url("images/vortrex-bg.png");
    background-size: cover;
    background-attachment: fixed;  
	}
	
	.footer {
		background: none;
        padding: 20px;
	}
	.footer-p {
		color: black;
		
	}
	.footer-link {
		color: red;
	}
	.footer-link:hover {
		text-decoration: none;
		color: darkred;
	}
	.navbar-default {
		background-image: url(../images/128-198.png);
        border-radius: 10px;
        border: solid;
	}
	.navbar-default .navbar-nav > li > a {
		color: black;
		text-align: center;
	}
	
	.navbar-default .navbar-nav > li > a:hover {
    color: darkgrey;
	}
	
	.navbar-default .navbar-nav > li > a:focus {
	color: none;
	}
	
	.navbar-default .navbar-nav .active > a,
	.navbar-default .navbar-nav .active > a:hover {
		color: black;
		background: darkgrey !important;
	}
	.img-circle {
	margin: -7px;
	}		
    .side-box-right {
        margin: 10px;
        padding: 10px;
        margin-top: 100px;
        float: right;
        border: solid;
        border-color: black;
        border-radius: 10px;
        background-image: url(../images/128-198.jpg);
        
    }
    .side-box-left {
        margin: 10px;
        padding: 10px;
        margin-top: 100px;
        float: right;
        border: solid;
        border-color: black;
        border-radius: 10px;
        background: darkgrey;
    }
    .nyheder {
        border: solid;
        background: darkgrey;
        border-radius: 10px;
    }

</style>
&#13;
<?php include('config/setup.php'); ?>
<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta charset="UTF-8">
		<?php include('config/css.php'); ?>
		<?php include('config/js.php'); ?>
		
		<title>Home | Vortrex</title>
			
	</head>
	<body>
		<div class="container">
        <div class="row">
			<div class="col-md-2">
				<div class="side-box-left">
					Teamspeak3 Class
				<?php
				/*	try
					{
					 	 
					  // show server as online
					  echo "Server Status: online<br />\n";
					  echo "Server IP: " . $ts3->getAdapterHost() . ":" . $ts3->virtualserver_port . "<br />\n";
					  echo "Server Name: " . $ts3->virtualserver_name . "<br />\n";
					  echo "Server Uptime: " . TeamSpeak3_Helper_Convert::seconds($ts3->virtualserver_uptime) . "<br />\n";
					  echo "Server Version: " . TeamSpeak3_Helper_Convert::version($ts3->virtualserver_version) . "<br />\n";
					  echo "Current Clients: " . $ts3->virtualserver_clientsonline . " / " . $ts3->virtualserver_maxclients . "<br />\n";
					}
					catch(Exception $e)
					{
					  // grab errors and show server as offline
					  echo "Server Status: offline<br />\n";
					} */
				?>
				</div>
			</div>
		<!-- RIGHT HERE -->	
          <div class="col-md-8"> 	
				<nav class="navbar navbar-default" role="navigation">
					<ul class="nav navbar-nav">
						<div class="navbar-header"><a class="navbar-brand" href="#"><img class="img-circle" alt="Brand" src="images/logo.png" height="32" width="32"></a></div>
						<li class="active"><a href="index.php">Home</a></li>
						<li><a href="statistik.php">Statistikker</a></li>
						<li><a href="/forum">Forum</a></li>
						<li><a href="#">Kontakt</a></li>
                        <li><a href="shop.php">Shop</a></li>
                        <li><a href="bans/index.php">Ban List</a></li>
					</ul>
				</nav><!-- Slutningen af navbaren -->
					
				<div class="nyheder">
					
					<!-- Overskrift på forsiden! -->
					
					<h1 align="center">Velkommen til Vortrex</h1>
					
					<!-- Overskrift på forsiden! -->
					
					<!-- I mellen <p> og </p> skrives hvad der skal stå på forsiden! -->
					<br>
					<br>
					<h3 align="center">Nyheder</h1>
					<p align="center">
						
						<?php #SKRIV HERUNDER! ?>
						
					
                        
                        
						<?php #SKRIV HEROVER! ?>
					</p>
					<!-- I mellen <p> og </p> skrives hvad der skal stå på forsiden! -->
			
                </div>
						
		</div>
		<div class="col-md-2">
			<div class="side-box-right">
			<?php
			
			$q = "SELECT * FROM server";
			$r = mysqli_query($dbc, $q);
				
				if($r) {
					
				
					while ($rows = mysqli_fetch_assoc($r)) {
					
					$online = $rows['online'];
					$status = $rows['status'];
					   
                        
						if($status == "Online") {
                            echo "<h3 align='center'><font color='green'>$status</font><br>$online / 200</h3>";
                            echo "<h4><strong>mc.vortrex.dk</strong></h4>";
                            } else {
                            echo "<h3 align='center'><font color='red'>$status</font></h3>";
                            echo "<h4><strong>mc.vortrex.dk</strong></h4>";
                            }
                         }
                        } else {
                        echo "<h2>Der skette en fejl der gjorde serverens status ikke kunne vises!</h2>";
                        echo "<br>";
                        echo "<h4>Kontakt et staff medlem!";

                        }

                        ?>

			</div>
		</div>	
</div>	
</div>
				
				<?php include(D_TEMPLATE.'/footer.php'); ?>	
				
				<!--<div id="console-debug">
					Test debug window
				</div>-->

	</body>
</html>
&#13;
&#13;
&#13;

感谢您的时间和帮助!

2 个答案:

答案 0 :(得分:0)

您的代码中有两个不同的图像文件夹路径

body {
    background-image: url("images/vortrex-bg.png");
    background-size: cover;
    background-attachment: fixed;  
    }

.navbar-default {
        background-image: url(../images/128-198.png);
        border-radius: 10px;
        border: solid;
    }

因此您需要修改其中一个并查看更改

答案 1 :(得分:0)

在您的代码中,您必须记住CSS代码的层次结构。看起来好像和你的风格有冲突。层次结构如下:1.In-line Attributes 2.ID Attributes 3.Class Attributes 4,Elements

您还调用了很多CSS样式表,然后添加自己的样式表。我会先打你的双重电话:

body {
background-image: url("images/vortrex-bg.png");
background-size: cover;
background-attachment: fixed;  
}

.navbar-default {
    background-image: url(../images/128-198.png);
    border-radius: 10px;
    border: solid;
}

然后检查以确保它不会干扰您通过样式表调用的内容。然后请注意,您没有ID属性,只有Classes。想想你想要优先考虑的事情,并利用等级制度来发挥你的优势。