简体   繁体   中英

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).

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

http://bjmarine.net/index.html - Works fine

I have compared both files and can't see any difference. I have tried them in editplus and notepad. 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).

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.

Can anyone provide a solution and a reason for whats happened?

Thanks Denis

Check out the encoding of the html file

index is ISO-8859-1 and service utf-16 (thats why you see weird characters).

Open the file in an editor, the clic in save as and change the encoding of service.html back to iso.

services.html appears to be encoded using UTF-16, so Firefox is trying to interpret the stylesheet using the same encoding.

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.

"********************************************" in the CSS file comments could be the problem try removing that.

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

And your source file for the broken one is encoded in UTF-16 according to Firefox (view source) but served as 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

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.

.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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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