2017-06-14 39 views
0

我似乎無法設計我的網站...例如<pre>標籤。Cant風格Bootstrap和普通元素

沒有我做的工作。我嘗試着設置whois結果的樣式,我嘗試將它包裝在div中,並設計樣式,只設置pre標籤樣式,設計所有樣式。我似乎無法得到它的工作。我希望我失去了一些愚蠢的東西。你可以從我曾嘗試多種組合的CSS看到(試圖刪除它們都只是有預ECT)

導航欄:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
    <link rel="stylesheet" type="text/css" href="stylesheet.css"> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
    <script type="text/javascript" src="javascript.js"></script> 
    <meta http-equiv="content-type" content="text/html; charset=windows-1250"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <meta name="generator" content="PSPad editor, www.pspad.com"> 
    <title>CWCS Domain Checker Tool</title> 
</head> 
<body> 
<!--- This Keeps the navbar from staying right near top --> 
<div class="header"> 
</div> 

<!---- Nav bar, Using bootstrap -----> 
<nav class="navbar navbar"> 
    <div class="container-fluid"> 
    <div class="navbar-header"> 
     <div class="nav-bar-logo"> 
     <a href="index.php" class="navbar-left"><img src="images/cwcs-logo.png"></a> 
     </div> 
     </div> 
    <div class="nav-list-container"> 
     <ul class="nav navbar-nav"> 
     <li><a href="domaindiagnostics.php">Domain Diagnostics</a></li> 
     <li><a id="sd" href="#">Server Diagnostics</a></li> 
     <li class="dropdown"> 
     <a class="dropdown-toggle" data-toggle="dropdown" href="#">Second Line Tools 
     <span class="caret"></span></a> 
     <ul class="dropdown-menu"> 
      <li><a id="dc" href="#">Daily Checklist</a></li> 
      <li><a id="bt" href="#">Backup Tracker</a></li> 
      <li><a id="tl" href="#">Task List</a></li> 
     </ul> 
     </li> 
    </ul> 
    </div> 
    </div> 
</nav> 
<!------- End of nav bar ----> 

首頁 -

<?php 
## Includes nav bar 
include('navbar.php'); 
include('phpfiles/domainclass.php'); 

if (isset($_GET['userInput'])) 
{ 
    $domainName = $_GET['userInput']; 
} 

?> 

<!---- The input form ----> 
<form class="form"> 
<div class="domainquery"> 
    <div class="input-group"> 
     <input id="domainName" name="userInput" class="form-control input-md" type="text" placeholder="example.com" value="<?php if (isset($domainName)) echo $domainName ?>" autocomplete="off" autofocus> 
     <div class="input-group-btn"> 
      <button type="submit" class="btn btn-primary btn-md">Query Domain</button> 
     </div> 
    </div> 
</div> 
</form> 
<!---- End of input form ---> 

<!---- start of content ---> 
<div class ="container-fluid"> 

<!----- Check of the variable has been set before showing ---> 
    <?php 
    ##checks if the variable name $domainName is set, before loading everything below 
    if (isset($domainName)): 
    ?> 
    <div class="container-fluid"> 
     <div class="row"> 
      <div class="col-lg-6 col-md-5 col-sm-12 col-xs-12"> 

    <h3>DNS Records </h3> 
      <div class="dnscontain"> 
        <script> 
         // Loads the return vaue of the call into the "dnscontain" div. 
         $(".dnscontain").load("ajaxhandler.php", 
         { // ajax call to pass variable to ajax handler, which then decides what to do with it   
           d: "<?php echo $domainName ?>", 
           q: 'dns' 
         }); 
        </script> 

      </div> 

    <h3>SSL Result</h3> 


    <h3>NMAP Result</h3> 
      <div class="nmapcontain"> 
        <script> 
         // Loads the return vaue of the call into the "dnscontain" div. 
         $(".nmapcontain").load("ajaxhandler.php", 
         { // ajax call to pass variable to ajax handler, which then decides what to do with it   
           d: "<?php echo $domainName ?>", 
           q: 'nmap' 
         }); 
        </script> 
      </div> 
    <h3>PING Result</h3> 
        <div class="pingcontain"> 
        <script> 
         // Loads the return vaue of the call into the "dnscontain" div. 
         $(".pingcontain").load("ajaxhandler.php", 
         { // ajax call to pass variable to ajax handler, which then decides what to do with it   
           d: "<?php echo $domainName ?>", 
           q: 'ping' 
         }); 
        </script> 
        </div> 
<!--- Closing div tag for left column -->   
</div> 

<!--- starting right column --> 
    <div class="col-lg-6 col-md-5 col-sm-12 col-xs-12"> 
     <h3>WHOIS Result</h3> 
      <div class="whoiscontain"> 
        <script> 
          // Loads the return vaue of the call into the "whoiscontain" div. 
          $(".whoiscontain").load("ajaxhandler.php", 
          { // ajax call to pass variable to ajax handler, which then decides what to do with it  
           d: "<?php echo $domainName ?>", 
           q: 'whois' 
          }); 
        </script> 
      <!--Whoiscontain div end -->   
      </div> 
<!--- right column div end -->   
    </div> 

<!--- closing div tag for 1st row ---> 
</div> 
</div> 
<!---- ends the check on if the variable is set -->   
<?php 
###End the "IF" check 
endif 
?> 

<!---- Closing div tag for container-fluid ---> 
</div> 


</body> 
</html> 

阿賈克斯回頁 -

<?php 
include 'domainclass.php'; 

$result = domain::getWhois($domainName); 
?> 

<pre class="whois"> <?php echo $result ?> </pre>; 

樣式表

.header 
{ 
    margin:1%; 
} 


.domainquery 
{ 
    margin-bottom:3%; 
    padding:40px 50px; 
} 

.nav-bar-logo 
{ 
    margin-right:20px; 
    padding-right:20px; 
} 

.table 
{ 
    font-size:5px; 
} 
pre .whois 
{ 
white-space:pre-wrap; 
background-color:black; 
color:white; 
word-wrap: break-word; 
} 

.whoiscontain 
{ 
white-space:pre-wrap; 
background-color:black; 
width:100%; 
color:white; 
word-wrap: break-word; 
} 

pre 
{ 
white-space:pre-wrap; 
background-color:black; 
color:white; 
word-wrap: break-word; 

} 

按要求輸出頁面的HTML(忽略引導樣式表上方的樣式表,正在嘗試某些內容。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<link rel="stylesheet" type="text/css" href="stylesheet.css"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
    <script type="text/javascript" src="javascript.js"></script> 
    <meta http-equiv="content-type" content="text/html; charset=windows-1250"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <meta name="generator" content="PSPad editor, www.pspad.com"> 
    <title>CWCS Domain Checker Tool</title> 
</head> 
<body> 
<!--- This Keeps the navbar from staying right near top --> 
<div class="header"> 
</div> 

<!---- Nav bar, Using bootstrap -----> 
<nav class="navbar navbar"> 
    <div class="container-fluid"> 
    <div class="navbar-header"> 
     <div class="nav-bar-logo"> 
     <a href="index.php" class="navbar-left"><img src="images/cwcs-logo.png"></a> 
     </div> 
     </div> 
    <div class="nav-list-container"> 
     <ul class="nav navbar-nav"> 
     <li><a href="domaindiagnostics.php">Domain Diagnostics</a></li> 
     <li><a id="sd" href="#">Server Diagnostics</a></li> 
     <li class="dropdown"> 
     <a class="dropdown-toggle" data-toggle="dropdown" href="#">Second Line Tools 
     <span class="caret"></span></a> 
     <ul class="dropdown-menu"> 
      <li><a id="dc" href="#">Daily Checklist</a></li> 
      <li><a id="bt" href="#">Backup Tracker</a></li> 
      <li><a id="tl" href="#">Task List</a></li> 
     </ul> 
     </li> 
    </ul> 
    </div> 
    </div> 
</nav> 
<!------- End of nav bar ----> 

<!---- The input form ----> 
<form class="form"> 
<div class="domainquery"> 
    <div class="input-group"> 
     <input id="domainName" name="userInput" class="form-control input-md" type="text" placeholder="example.com" value="lomcn.org" autocomplete="off" autofocus> 
     <div class="input-group-btn"> 
      <button type="submit" class="btn btn-primary btn-md">Query Domain</button> 
     </div> 
    </div> 
</div> 
</form> 
<!---- End of input form ---> 

<!---- start of content ---> 
<div class ="container-fluid"> 

<!----- Check of the variable has been set before showing ---> 
    <div class="container-fluid"> 
     <div class="row"> 
      <div class="col-lg-6 col-md-5 col-sm-12 col-xs-12"> 

    <h3>DNS Records </h3> 
      <div class="dnscontain"> 
        <script> 
         // Loads the return vaue of the call into the "dnscontain" div. 
         $(".dnscontain").load("ajaxhandler.php", 
         { // ajax call to pass variable to ajax handler, which then decides what to do with it   
           d: "lomcn.org", 
           q: 'dns' 
         }); 
        </script> 

      </div> 

    <h3>SSL Result</h3> 


    <h3>NMAP Result</h3> 
      <div class="nmapcontain"> 
        <script> 
         // Loads the return vaue of the call into the "dnscontain" div. 
         $(".nmapcontain").load("ajaxhandler.php", 
         { // ajax call to pass variable to ajax handler, which then decides what to do with it   
           d: "lomcn.org", 
           q: 'nmap' 
         }); 
        </script> 
      </div> 
    <h3>PING Result</h3> 
        <div class="pingcontain"> 
        <script> 
         // Loads the return vaue of the call into the "dnscontain" div. 
         $(".pingcontain").load("ajaxhandler.php", 
         { // ajax call to pass variable to ajax handler, which then decides what to do with it   
           d: "lomcn.org", 
           q: 'ping' 
         }); 
        </script> 
        </div> 

    <h3>Tracert Result</h3> 
        <div class="tracecontain"> 
        <script> 
         // Loads the return vaue of the call into the "dnscontain" div. 
         $(".tracecontain").load("ajaxhandler.php", 
         { // ajax call to pass variable to ajax handler, which then decides what to do with it   
           d: "lomcn.org", 
           q: 'trace' 
         }); 
        </script> 
        </div> 
<!--- Closing div tag for left column -->   
</div> 

<!--- starting right column --> 
    <div class="col-lg-6 col-md-5 col-sm-12 col-xs-12"> 
     <h3>WHOIS Result</h3> 
      <div class="whoiscontain"> 
        <script> 
          // Loads the return vaue of the call into the "whoiscontain" div. 
          $(".whoiscontain").load("ajaxhandler.php", 
          { // ajax call to pass variable to ajax handler, which then decides what to do with it  
           d: "lomcn.org", 
           q: 'whois' 
          }); 
        </script> 
      <!--Whoiscontain div end -->   
      </div> 
<!--- right column div end -->   
    </div> 

<!--- closing div tag for 1st row ---> 
</div> 
</div> 
<!---- ends the check on if the variable is set -->   

<!---- Closing div tag for container-fluid ---> 
</div> 


</body> 
</html> 
+0

變化'預.whois'爲'pre.whois'和固定每個@ tilz0R的回答你的'link'標籤 –

+0

缺少「<」標記是複製並粘貼錯誤。嘗試pre.whois仍然沒有快樂><我想要樣式所有「pre」相同的tbf,但即使只是預選擇css似乎沒有任何效果。奇怪的事情是一些的CSS正在工作,例如標題/導航欄徽標工作正常 – TheOne745665

+1

而不是顯示我們的PHP和AJAX響應,你可以把HTML呈現在瀏覽器中的頁面在這裏,所以我們不必須將這些作品放在一起才能看到CSS問題? –

回答

0

爲了引導樣式,您可以搭配引導樣式或製作自己的新樣式。

他們建議不要直接編輯引導程序.CSS,以便引導更新不會改變您的設計。

將您自己的樣式表調用放置在引導程序調用下方時是正確的,因此您將覆蓋。

即使你的風格會超過你可能無法搭載具有!重要標籤的引導規則。您可以使用樣式表中的自舉類和ID的做出新的規則,使用自己的重要,如果有必要,迫使他們通過,或添加其他類的風格:

a bit of code

was `<div class="col-md-12">` 

    make `<div class="col-md-12 myCol">` 

和然後進行規則上的樣式表

.myCol { 這些樣式應該堅持 }