2014-02-20 30 views
0

我有一个网页,我试图打印它。我正在使用引导程序导航栏。问题是,当我使用bootstarp导航栏时,打印预览没有任何意义。我在页面中看到代码行,而不是实际的内容。打印与引导加扰

<link href="css/bootstrap.min.css" rel="stylesheet"> 
<link href="design.css" rel="stylesheet"> 
<link rel="stylesheet" type="text/css" media="print" href="design.css"> 
<body> 

<div class="navbar navbar-inverse navbar-static-top" > 
     <div class="container"> 

      <a href="http://localhost/sapir/registration.php" class="navbar-brand"><img src="http://sphotos-h.ak.fbcdn.net/hphotos-ak-prn1/41032_147610068590926_4173889_n.jpg" id="logo"></a> 

      <button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse"> 
       <span class="icon-bar"></span> <span class="icon-bar"></span> <span 
        class="icon-bar"></span> 
      </button> 

      <div class="collapse navbar-collapse navHeaderCollapse"> 

       <ul class="nav navbar-nav navbar-right"> 


        <li><a href="javascript&#058;print(document)"><img src="https://cdn1.iconfinder.com/data/icons/nuvola2/128x128/devices/print_printer.png" id="logo" ></a></li> 
        <li><a href="Register.html">Register</a></li> 
        <li><a href="customer.html">Clients</a></li> 
        <li><a href="Administrator.html">Administrator</a></li> 
        <li><a href="account.html">Accounts</a></li> 
        <li><a href="Illustration.html">Illustration</a></li> 
        <li class="active"><a href="http://localhost/sapir/php-calendar-2.0/index.php">שיבוץ</a></li> 
        <li class="dropdown"><a href="#" class="dropdown-toggle"></li> 

       </ul> 

      </div> 

     </div> 
    </div> 
</body> 

什么我需要做这样的页面会:当我refferance添加到bootstrap.min.css 我的网页(相关部分)(下面的代码所示) 问题只发生正确打印(没有导航栏)?

这是问题的一个形象:http://postimg.org/image/mk0vwde8b/6e80e14d/

+0

打印时是否需要显示导航栏?如果没有,print css中的“display:none”。除此之外,它听起来像你有一个HTML错误。运行你的代码:http://validator.w3.org/ –

+0

这个html,我只是将它导入到一个php页面,我想打印php内容而不是导航栏。下面的解决方案并不适合我。任何其他想法? – user2674835

回答

1

您可以使用CSS媒体查询来创建打印页面时隐藏的类。

@media print {  
    .print-hide .print-hide * { 
     display: none !important; 
    } 
} 

现在类.print-hide添加到导航栏和其他任何你想打印的页面时,隐藏!

+0

我看到了这个解决方案,它不适合我。 – user2674835

+0

打印时导航栏没有隐藏? – binaryatrocity

+0

我看不出,可打印的内容不是在网页上看到的,就像它试图打印代码行,并且网址的 – user2674835