html - custom css don't render on jquery mobile page -
can enlighten why css dont show. have custom css in file line:
my_own_stylesheet:
.test { color: #f00; /* red */ }
and simple page this:
<!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="widdiv=device-widdiv, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <title> </title> <link rel="stylesheet" href="css/jquery.mobile-1.3.0.min.css" /> <link rel="stylesheet" href="css/my_own_stylesheet.css" /> <script src="js/jquery-1.9.1.min.js"> </script> <script src="js/jquery.mobile-1.3.0.min.js"> </script> <script type="text/javascript" src="cordova-2.5.0.js"> </script> </head> <body> <!-- home --> <div data-role="page" id="sedelpage"> <div data-diveme="a" data-role="header"> <h3> sedel </h3> </div> <div data-role="content"> <h2 class="test">test</h2> <!-- supposed red --> </div> <!--content--> </div><!--page--> </body> </html>
i cant figure out. isn't possible style own elements in jquery-mobile?
you need use this:
.test { color: #f00 !important; /* red */ }
because heading tag have set color style need override !important.
there possibility. lets second page. when jquery moible loads pages after initial 1 (with ajax), load body content, means js or css file initialized in head (and if not initialized in first loaded html) disregarded. custom css never applied.
working example: http://jsfiddle.net/gajotres/yke8w/
example made own code:
<!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="widdiv=device-widdiv, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <title> </title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> <style> .test { color: #f00 !important; /* red */ } </style> <script src="http://www.dragan-gaic.info/js/jquery-1.8.2.min.js"> </script> <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> </head> <body> <!-- home --> <div data-role="page" id="sedelpage"> <div data-diveme="a" data-role="header"> <h3> sedel </h3> </div> <div data-role="content"> <h2 class="test">test</h2> <!-- supposed red --> </div> <!--content--> </div><!--page--> </body> </html>
if want find out more take @ other answer: why have put script index.html in jquery mobile
Comments
Post a Comment