Support » Plugin: MetaSlider » Meta Slider v. 2.3.1 xhtml validation error

  • Resolved


    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('');
    @import url('');
    <div id="metaslider_container_24304">
    <div id="metaslider_24304" class="flexslider">
    <ul class="slides">
    <li style="display: none;"><a href=""><img src="" height="360" width="850" alt="Bill Burke" class="slider-24304 slide-24762" /></a>
    <li style="display: none;"><a href=""><img src="" 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.]


Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor matchalabs


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



    I’ll; do that – Thanks, Tom!

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



    Forum Moderator

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

    Plugin Contributor matchalabs


    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


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Meta Slider v. 2.3.1 xhtml validation error’ is closed to new replies.