-2

I need to make my website valid to past the school project. On my website there are few code snippets, which I implemented and when I check it on w3 validator, this error pops out: Named character reference was not terminated by a semicolon. (Or & should have been escaped as &.)

This is the website

I don't quite understand the error message. Can someone explain?

<pre><code> <!-- Example of code (Carousel -->

       &ltdiv class="navbar navbar-fixed-top navbar-default" role="navigation"&gt
        &ltdiv class="container"&gt

           &ltbutton class="navbar-toggle" data-target=".navbar-responsive-collapse" data-toggle="collapse" type="button"&gt
              &ltspan class="icon-bar"&gt&lt/span&gt
              &ltspan class="icon-bar"&gt&lt/span&gt
              &ltspan class="icon-bar"&gt&lt/span&gt
           &lt/button&gt

           &lta class="navbar-brand" href="index.html"&gtFUTURE LOGO&lt/a&gt 
             &ltdiv class="visible-xs  clearfix"&gt&lt/div&gt


           &ltdiv class="navbar-collapse navbar-responsive-collapse collapse"&gt
              &ltul class="nav navbar-nav"&gt

                 &ltli&gt&lta href="index.html"&gt&ltspan class="glyphicon glyphicon-home"&gt&lt/span&gt Domu&lt/a&gt&lt/li&gt


                 &ltli&gt&lta href="obsahmp.html"&gtObsah MP&lt/a&gt&lt/li&gt

                 &ltli class="dropdown"&gt&lta href="#" class="dropdown-toggle" data-toggle="dropdown"&gt
                 Responzivní webdesign&ltstrong class="caret"&gt&lt/strong&gt&lt/a&gt
                    &ltul class="dropdown-menu"&gt
                      &ltli&gt&lta href="responzivniwebdesign.html"&gtCo to vlastně je?&lt/a&gt&lt/li&gt
                      &ltli&gt&lta href="webovarozvrzeni.html"&gtWebová rozvržení&lt/a&gt&lt/li&gt
                      &ltli&gt&lta href="howto.html"&gtTvorba responzivního webu&lt/a&gt&lt/li&gt

                      &ltli class="divider"&gt&lt/li&gt

                      &ltli class="dropdown-header"&gtCSS frameworky&lt/li&gt
                      &ltli&gt&lta href="frameworky.html"&gtCo, jak a proč?&lt/a&gt&lt/li&gt
                      &ltli&gt&lta href="bootstrap.html"&gtTwitter bootstrap&lt/a&gt&lt/li&gt
                    &lt/ul&gt&lt!-- End dropdown-menu--&gt
                 &lt/li&gt&lt!-- End dropdown--&gt

                 &ltli class="dropdown active"&gt&lta href="#" class="dropdown-toggle" data-toggle="dropdown"&gt
                 Použité komponenty&ltstrong class="caret"&gt&lt/strong&gt&lt/a&gt
                    &ltul class="dropdown-menu"&gt
                      &ltli&gt&lta href="navbar.html"&gtNavbar&lt/a&gt&lt/li&gt
                      &ltli&gt&lta href="carousel.html"&gtCarousel&lt/a&gt&lt/li&gt
                    &lt/ul&gt&lt!-- End dropdown-menu--&gt
                 &lt/li&gt&lt!-- End dropdown--&gt
              &lt/ul&gt&lt!--End nav--&gt
           &lt/div&gt&lt!-- End navbar-collapse--&gt
        &lt/div&gt &lt!-- End container--&gt
    &lt/div&gt &lt!-- End navbar--&gt



                </code></pre> <!-- End of example of code (Carousel -->
Tomáš Nosek
  • 213
  • 2
  • 12
  • Please add meaningful code and a problem description here. Don't just link to the site that needs fixing - otherwise, this question will lose any value to future visitors once the problem is solved or if the site you're linking to is inaccessible. Posting a [Minimal, Complete, and Verifiable example (MCVE)](http://stackoverflow.com/help/mcve) that demonstrates your problem would help you get better answers. For more info, see [Something on my web site doesn't work. Can I just paste a link to it?](http://meta.stackexchange.com/questions/125997/) Thanks! – j08691 Sep 26 '15 at 14:15
  • I implemented the code to the question @j08691 – Tomáš Nosek Sep 26 '15 at 14:20

1 Answers1

1

You're displaying HTML syntax on your page, to do that you're using entities such as &lt; (which stands for less than sign <). Except in your code the ; seems to be missing (just &lt) from all those entities, which is what the validator is complaining about.

When I copied your source into notepad and replaced all &lt and &gt with &lt; and &gt; the validator threw no errors.

(If the code you're trying to validate is actually the code in the code box, then you shouldn't be running the validation on the page...)

Community
  • 1
  • 1
Talya S
  • 734
  • 5
  • 20
  • I need to validate the whole webpage, there is no need for the code in the box to be valid for me @Talya S – Tomáš Nosek Sep 26 '15 at 14:19
  • My answer stands then. You're replying to what I added as a parantheses in case I misunderstood- and I didn't. The error is coming from how the code in the box is written to show up as code on your page. You use `&lt` to show a `<` sign, but the valid syntax is `<`. – Talya S Sep 26 '15 at 14:24