Meta Slider
[resolved] Meta Slider v. 2.3.1 xhtml validation error (6 posts)

  1. mgorzka@curtislibrary.com
    Posted 2 years ago #

    Hello all,

    When I try to validate the page that Meta Slider is installed on (XHTML transitional), I get this validation error:

    Line 113, Column 27: document type does not allow element "style" here

    <style type="text/css">

    Here's how it appears within the markup on that page:

    <!-- meta slider -->
    <div style="max-width: 850px;" class="metaslider metaslider-flex metaslider-24304 ml-slider">
    <style type="text/css">
    @import url('http://www.curtislibrary.com/wp-content/plugins/ml-slider/assets/metaslider/public.css?ver=2.3.1');
    @import url('http://www.curtislibrary.com/wp-content/plugins/ml-slider/assets/sliders/flexslider/flexslider.css?ver=2.3.1');
    <div id="metaslider_container_24304">
    <div id="metaslider_24304" class="flexslider">
    <ul class="slides">
    <li style="display: none;"><a href="http://www.curtislibrary.com/25186-2/"><img src="http://www.curtislibrary.com/wp-content/uploads/2013/08/other-creator-rotating-gallery-bill1.jpg" height="360" width="850" alt="Bill Burke" class="slider-24304 slide-24762" /></a>
    <li style="display: none;"><a href="http://www.curtislibrary.com/24862-2/"><img src="http://www.curtislibrary.com/wp-content/uploads/2013/08/other-creator-rotating-gallery-maria1.jpg" height="360" width="850" alt="Maria Castellano-Usery" class="slider-24304 slide-24763" /></a>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]



  2. Matcha Labs
    Plugin Author

    Posted 2 years ago #

    Hi Mike,

    XHTML is quite an old specification (2001) and is pretty strict, Meta Slider won't (and probably won't ever) output valid XHTML. The tradeoff of putting the style tags into the header of every page (not just the ones meta slider is on) is too great to achieve compatibility with an old standard.

    But, HTML5 (2012) is more standard nowadays. You can achieve HTML5 compatibility by adding this to your themes functions.php file:

    function ms_scoped() {
        return ' scoped';
    add_filter('metaslider_style_attributes', 'ms_scoped', 25, 3);


  3. mgorzka@curtislibrary.com
    Posted 2 years ago #

    I'll; do that - Thanks, Tom!

  4. orbitbob
    Posted 2 years ago #

    I have the same issue and when I put the above code in my functions.php file it broke the entire slider.

  5. esmi
    Forum Moderator
    Posted 2 years ago #

    As per the Forum Welcome, please post your own topic.

  6. Matcha Labs
    Plugin Author

    Posted 2 years ago #

    Just posting this for anyone who has found this thread on Google.

    I've been working on a plugin to move the Meta Slider link, inline script and style blocks into the <head> of the page:


    To install, click 'Download ZIP', then go to Plugins > Add New > Upload and select the .zip file. So far there isn't a settings page or anything like that.

    If you're using this plugin, please let me know how it goes! I may integrate the functionality into the Meta Slider plugin if it's working well


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Meta Slider
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic