微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 我的CSS代码没有正确读取TinyMCE

几个月前,我发布了一个关于如何在图片上方悬停时显示标题的问题.

这是线程:

Don’t understand how to show the caption when hovering image

问题是,当我使用TinyMce编辑标题时,它不会显示标题悬停.相反,它没有显示任何标题,它只是徘徊.

这是编辑方面(我缩短了它):

 <script language="javascript" type="text/javascript">//<![CDATA[
  tinyMCE.init({
        // General options
        mode: "textareas",
        elements : "ajaxfilemanager",
        theme : "advanced",
});
//]]</script>

这是输出

<html> 
<head>
<Meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>

<style>
#caption { display: none;font:12px Times New Roman;}
img:hover + #caption { position: absolute; display: block;}
.caption { display:none; text-decoration: none; font:12px Times New Roman;}
.image-with-caption:hover .caption {display: block; text-decoration: none;}
a:hover { text-decoration: none; } 
</style>

<table width="100%">
<tr>
<td>
<?PHP echo(stripslashes($_POST['content'])); ?>
</td>
</tr>
</table>

</body>
</html>

这是我将代码复制并粘贴到TinyMCE中的输入:

 <table width="100%">
 <tr>
 <td>
 <div class="image-with-caption">
 <a href="images/artistc.PHP">
 <img src="images/imagec08.jpg" style="width:209px" />
 <p id="caption">Caption 3</p>
 </a>  
 </div>
 </td>
 <td>
 <div class="image-with-caption">
 <a href="images/artistb.PHP">
 <img src="images/imageb12.jpg" style="width:195px" />
 <p id="caption">Caption 5</p> 
 </a>
 </div>
 </td>
 <td>
 <div class="image-with-caption">
 <a href="images/artista.PHP">
 <img src="images/imagea02.jpg" style="width:260px" />
 <p id="caption">Caption 4</p>
 </a> 
 </div>
 </td>
 </tr>
 </table>

任何建议和意见将不胜感激.我只是想知道为什么它没有显示标题.

解决方法:

我不完全理解你的问题,但我看到你有几个ID相同的标签.这是不允许的.也许如果你解决了这个问题,它有助于解决问题.你应该用class =“caption”(或其他任何东西)替换id =“caption”,然后用.caption修改你的css替换#caption

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐