简体   繁体   English

为什么我的网页无法应用其CSS?

[英]Why can't my web page apply its CSS?

I have a simple website(primarily static html/css) but for some reason some of the pages won't apply the external css in Firefox (works in IE). 我有一个简单的网站(主要是静态html / css),但由于某些原因,某些页面无法在Firefox中使用外部CSS(在IE中有效)。

http://bjmarine.net/services.html - Is broken http://bjmarine.net/services.html-损坏

http://bjmarine.net/index.html - Works fine http://bjmarine.net/index.html-效果很好

I have compared both files and can't see any difference. 我已经比较了两个文件,看不到任何区别。 I have tried them in editplus and notepad. 我已经在editplus和记事本中尝试过它们。 When I view the broken page with firebug and fresh I start to see some chinese characters all over the place. 当我用萤火虫和新鲜的东西查看破碎的页面时,我开始在各处看到一些汉字。 Not sure how to fix this, or how it happended. 不知道如何解决此问题,或如何发生。 I'm worried the site has been altered by someone else or perhaps an editor added these hidden characters some how (I only use VS2008 and editplus). 我担心该网站已被其他人更改,或者编辑可能以某种方式添加了这些隐藏字符(我仅使用VS2008和editplus)。

I can see an error in the js on the broken page but the same code doesn't give an error on the working page. 我可以在残破页面上的js中看到错误,但相同的代码在工作页面上未显示错误。

Can anyone provide a solution and a reason for whats happened? 谁能提供解决方案和发生原因的原因?

Thanks Denis 谢谢丹尼斯

Check out the encoding of the html file 检查html文件的编码

index is ISO-8859-1 and service utf-16 (thats why you see weird characters). 索引是ISO-8859-1和服务utf-16(这就是为什么您看到奇怪的字符的原因)。

Open the file in an editor, the clic in save as and change the encoding of service.html back to iso. 在编辑器中打开文件,另存为,然后将service.html的编码更改回iso。

services.html appears to be encoded using UTF-16, so Firefox is trying to interpret the stylesheet using the same encoding. services.html似乎是使用UTF-16编码的,因此Firefox尝试使用相同的编码来解释样式表。

Be consistent about the encoding you use (UTF-8 is a good choice), and configure your webserver to specify that encoding in the HTTP response headers. 关于您使用的编码保持一致(UTF-8是一个不错的选择),并配置您的网络服务器以在HTTP响应标头中指定该编码。

"********************************************" in the CSS file comments could be the problem try removing that. CSS文件中的“ ************************************************”评论可能是尝试删除该问题的问题。

Warning: Unexpected end of file while searching for ',' or '{'. 警告:搜索','或'{'时,文件末尾意外。 Ruleset ignored due to bad selector. 由于选择器错误,规则集被忽略。 Source File: http://bjmarine.net/images/bjmarine.css Line: 1 源文件: http : //bjmarine.net/images/bjmarine.css行:1

And your source file for the broken one is encoded in UTF-16 according to Firefox (view source) but served as iso-8859-1. 并且根据Firefox(查看源),将损坏的源文件编码为UTF-16(但已作为iso-8859-1使用)。

您的javascript中出现错误:_gat未在...中定义。它看起来像services.html中的第184行。

You might want to make sure that you path for the stylesheet is actually reaching the folder where your stylesheet resides. 您可能要确保样式表的路径实际上到达了样式表所在的文件夹。

The full path should be http://bjmarine.net/images/bjmarine.css 完整路径应为http://bjmarine.net/images/bjmarine.css

Here is your full page with the path corrected. 这是您的整页,路径已更正。

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta name="Description" content="Boats, Power, Sail, Marina, Berths, Malahide, Dublin, Bangor, Cork, Malta" />
<meta name="Keywords" content="your, keywords" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Distribution" content="Global" />
<meta name="Author" content="Denis Hoctor - denishoctor&#64;gmail.com" />
<meta name="Robots" content="index,follow" />

<link rel="stylesheet" href="http://bjmarine.net/images/bjmarine.css" type="text/css" /><link rel="icon" href="/favicon.ico" type="image/x-icon">

<title>BJ Marine.net Power/Sail New &amp; Used Boats</title>


</head>

<body>
<!-- wrap starts here -->
<div id="wrap">

    <div id="header">

        <div id="logo"><img src="images/BJMarineLogo811x77.jpg" width="811" height="77" alt="BJ Marine Header" class="no-border" /></div>    

        <!-- Menu Tabs -->
        <ul>
            <li><a href="index.html"><span>Home</span></a></li>

            <li><a href="featuredboats.html"><span>FeaturedBoats</span></a></li>
            <li><a href="newboats.html"><span>NewBoats</span></a></li>
            <li><a href="brokerage.html"><span>UsedBoats</span></a></li>
            <li><a href="ouroffices.html"><span>OurOffices</span></a></li>
            <li><a href="salesteam.html"><span>SalesTeam</span></a></li>
            <li><a href="sellyourboat.html"><span>SellYourBoat</span></a></li>

            <li id="current"><a href="services.html"><span>Services</span></a></li>
            <li><a href="contact.html"><span>Contact</span></a></li>
        </ul>

    </div>

    <!-- content-wrap starts here -->
    <div id="content-wrap">    

      <div id="header-columns">

        <div class="col7"><a href="new/newboatsframe.html#http://www.beneteau.com/" id="img_rollover_beneteau"><span>Beneteau</span></a></div>
        <div class="col7"><a href="new/newboatsframe.html#http://www.searay.com/" id="img_rollover_searay"><span>Searay</span></a></div>
        <div class="col7-center"><a href="new/newboatsframe.html#http://www.cranchi.com/" id="img_rollover_cranchi"><span>Cranchi</span></a></div>
        <div class="col7-center"><a href="new/newboatsframe.html#http://www.ferretti-yachts.com/" id="img_rollover_ferretti"><span>Ferretti</span></a></div>
           <div class="col7-center"><a href="new/newboatsframe.html#http://www.customline-yacht.com/" id="img_rollover_customline"><span>Customline</span></a></div>
        <div class="col7-center"><a href="new/newboatsframe.html#http://www.mochicraft.com/" id="img_rollover_mochicraft"><span>Mochi Craft</span></a></div>

        <div class="col7-center"><a href="new/newboatsframe.html#http://www.searanger.com/" id="img_rollover_searanger"><span>Searanger</span></a></div>
      </div>

        <div id="main">
            <h1>Services</h1>

            <p>At our bases in Malahide and Bangor we have the best lifting and boatyard facilities 
            on the east coast, with capacity for 180 boats ashore in safe, secure boatyards.</p>

            <h3>Parts Department</h3>

            <div class="staff-columns">
                <div>
                    <p>Our parts department can be contacted directly by email at <a href="mailto:parts&#64;bjmarine.net">parts&#64;bjmarine.net</a> or telephone <strong>+353 1 8061560</strong>. We supply a comprehensive range of all spare parts for the boat brands that we sell. We also supply the following –</p>
                    <ul style="padding-left: 60px;">
                        <li>Raymarine onboard marine electronic instruments</li>

                        <li>Garmin marine equipment</li>
                        <li>C-Map electronic navigation charts</li>
                        <li>Navionics Marine Charts</li>
                        <li>Garmin Bluechart</li>
                        <li>Sparcraft masts, booms and rigging systems</li>
                        <li>Facnor furling systems</li>

                        <li>Quantum Sails, premier sail design and suppliers</li>
                        <li>Volvo, Yanmar and Mercruiser marine engine parts</li>
                        <li>Trailers</li>
                    </ul>
                </div>
            </div>
            <a href="http://www.dmgsailsports.com/"><img src="images/dmglogo.jpg" width="294" height="130" alt="DMG services" class="float-right-noborder" /></a>

            <br />
            <h3>Training</h3>
            <p>DMG Sailsports is an ISA Training Centre based in Malahide, Co. Dublin, Ireland. Their courses are based on the ISA Powerboat Scheme and ISA Windsurfing Schemes. Personalised private sail coaching is available to those who have their own boats and would like lessons tailored to their specific needs by our highly experienced ISA Instructors. All of our courses are delivered to the highest standards for both professional and recreational clients and are run all year round, 7 days a week.</p>
            <br />
            <h3>Marina Berths</h3>
            <p>We can facilitate your boating needs in Portugal, Spain, France, Malta and many other Mediterranean destinations Berths and deliveries etc.</p>
            <br />

            <a href="http://www.lombard.ie/lombard/ireland/personal_customers/marine/index.html"><img src="images/lombard.jpg" width="220" height="83" alt="Lombard Marine Finance" class="float-right-noborder" /></a>
            <h3>Finance</h3>
            <p>Whatever your boating dream you could realise it quickly and easily with <a href="http://www.lombard.ie/lombard/ireland/personal_customers/marine/index.html">Lombard Marine Finance</a>.</p>
            <br /><br />
            <h3>Weather and tides</h3>
            <ul class="tidelist">

                <li>
                    <a href="http://www.met.ie/forecasts/sea-area.asp">Met Eireann</a> – Sea area Forcast
                    <a href="http://www.met.ie/forecasts/sea-area.asp"><img src="images/met_logo.gif" width="60" height="32" alt="MET Eireann logo" class="float-right-noborder-tides" /></a>
                </li>
                <li><a href="http://www.met.ie/latest/buoy.asp">M2 Weather buoy</a> – Approx 20 nautical miles east of Howth Headt</li>
                <li>
                    <a href="http://www.ireland.com/weather/tides.htm">Irish Daily Tides</a>

                    <a href="http://www.ireland.com/weather/tides.htm"><img src="images/irishtimes_logo.gif" width="175" height="17" alt="Irish Times logo" class="float-right-noborder-tides" /></a>
                </li>
                <li>
                    <a href="http://www.windguru.cz/int/index.php?sc=47773">WindGuru</a>
                    <a href="http://www.windguru.cz/int/index.php?sc=47773"><img src="images/windguru_logo.gif" width="175" height="55" alt="Wind Guru logo" class="float-right-noborder-tides" /></a>
                </li>
            </ul>
        </div>


    <!-- content-wrap ends here -->        
    </div>

    <div id="footer-wrap">
        <div id="footer-columns">
            <div class="col3">
                <h3>Dublin</h3>
                <code>
                    Malahide<br />

                    Dublin, Ireland<br />
                    Tel:(+353) 1 8061560<br />
                    <a href="mailto:sales&#64;bjmarine.net">sales&#64;bjmarine.net</a>
                </code>
            </div>

            <div class="col3-center">

                <h3>Cork</h3>
                <code>
                    Co. Cork<br />
                    Ireland<br />
                    Tel:(+353) 87 7712224<br />
                    <a href="mailto:sales&#64;bjmarine.net">sales&#64;bjmarine.net</a>

                </code>
            </div>

            <div class="col3-center">
                <h3>Belfast</h3>
                <code>
                    Bangor Marina<br />
                    Co. Down, N. Ireland<br />

                    Tel:(+44) 2891 271434<br />
                    <a href="mailto:sales&#64;bjmarine.net">sales&#64;bjmarine.net</a>
                </code>
            </div>

            <div class="col3">
                <h3>Mediterranean</h3>

                <code>

                    Grand Harbour Marina<br />
                    Malta<br />
                    Tel:(+356) 27019356<br />
                    <a href="mailto:sales&#64;bjmarine.net">sales&#64;bjmarine.net</a>
                </code>

            </div>
        <!-- footer-columns ends -->
        </div>

        <div id="footer-bottom">        

            <p>
            &copy; 2008 <strong>BJ Marine Ltd.</strong> | 
            Design by: <a href="mailto:denishoctor&#64;gmail.com">Denis Hoctor</a> | 
            Valid <a href="http://validator.w3.org/check?uri=referer">XHTML</a> | 
            <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>


           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

            <a href="index.html">Home</a>&nbsp;|&nbsp;
           <a href="contact.html">Contact</a>
           </p>    

        </div>    

<!-- footer ends-->
</div>
<!-- wrap ends here -->
</div>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-1206900-2");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</body>
</html>

Placing this path in the page itself locally got eveything except your logo to come up. 除了显示徽标外,将此路径本地放置在页面本身中也很容易。

Good luck, hope this helps you. 祝您好运,希望对您有所帮助。

Looks like you have some css errors. 看起来您有一些CSS错误。

.align-centre

Might be spelled wrong and the selectors properties are not closed with: 可能拼写错误,并且选择器属性未通过以下方式关闭:

}

I would run through the css file and make sure it is valid. 我将运行css文件,并确保它是有效的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM