<!DOCTYPE html> <html lang="ja"> <head> <{$content_type|smarty:nodefaults}> <link rel="stylesheet" href="<{$root_surl}>css/master.css" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> //--- ajax function postLike(){ var fb_id = '<{$fb_id}>'; var quiz_id = '<{$quiz_id}>'; $.ajax({ type: 'post', url: 'question.php', data: {fbid:fb_id, quizid:quiz_id}, success: function(data){ }, error: function(jqXHR, status, error){ } }); } $(function(){ $("span.nextLike").click(postLike); }); </script> <style type="text/css"> <!-- .nextLike { background: url(../images/likeButton.png) no-repeat 0 0; width: 40px; height: 40px; _width: 40px; _height: 40px; cursor: pointer; } .nextLike:hover { background-position: 0px -40px; } --> </style> </head> <body> <span class="nextLike"> </span> </body> </html>
▽1
●
nobuoka ●100ポイント ベストアンサー |
(1) についてですが、span 要素はインライン要素なので、CSS の width プロパティや height プロパティで幅や高さを指定しても無視されます。 背景画像が表示されないのではなくて、要素の大きさが期待通りの大きさになっていないのではないでしょうか?