我想知道是否可以为通过 tinyMCE 上传的图像添加一个类。
我有这个从我的数据库中调用描述的字符串。
<div class="articletext"><?$string = $image["description"];
目前,为了使图像具有响应性,我添加了这个内联 CSS。
<style> img{width:100%; height:auto;}</style>
它工作正常我只是觉得它有点马虎,想看看是否有更好的方法。
渲染后的输出代码如下所示:在 articletext 下方是显示图像的位置。
<div class="grid_4">
<style> img{width:100%; height:auto;}</style>
<div data-id="id-80">
<article class="box white-bg mb-25">
<div class="notices-title">Test Image In Post 1</div>
<div class="newsdate" style="margin: 10px 0 !important;">February 26, 2014</div>
<div class="articletext"><p><img src="../../htp_filemanager/source/AllImages/bob-van-aubel-ray-bans.jpg" alt="bob-van-aubel-ray-bans" /></p>
<p>This is a test.</div>
我正在寻找一种在通过 tinyMCE 上传图像时自动添加 class="img-max"
的方法。
最佳答案
使用下面的样式可以轻松解决问题。
<style>.newsdate img{width:100%; height:auto;}</style>
关于javascript - 从 tinyMCE 向图像添加类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22059048/