How to centre a javascript element using inline css? -


i've got javascript code want centring on webpage, if enclose <div align="center"> works perfectly, validator says not valid html5.

i've tried changing "margin: 0 auto;" no luck. i've tried using "text-align: center" , doesn't work either. i've added .center {margin: 0 auto}; stylesheet , doesn't work either.

just curious why code won't centre correctly using of techniques.

my working code follows.

<div align="center">  <script type="application/javascript">         var mycountdowntest = new countdown({                                             month   : 5,                                              day     : 19,                                             width   : 300,                                              height  : 50,                                             hideline: true,                                             rangehi :"months"                                             });         </script> </div> 

try following code.

 .center          {              width:300px; /*this same countdown width in javascript*/              margin: 0 auto;                        text-align:center;          }
    <div class="center">       <script type="application/javascript">              var mycountdowntest = new countdown({                                                  month   : 5,                                                   day     : 19,                                                  width   : 300,                                                   height  : 50,                                                  hideline: true,                                                  rangehi :"months"                                                  });              </script>            </div>


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -