最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Shortcode not staying inside div tag

programmeradmin2浏览0评论

Using this php to show a signup form in my template file:

<div style="border: 3px solid green; margin-top: 1em; height: auto">
<h2>Blog notifications</h2>
<?php echo do_shortcode('[forminator_form id="9979"]'); ?>
</div>

Looking like this:

That white block at the bottom is just another div that follows.

The shortcode is not being recognised by the div and is displaying outside it. Not sure why this is.

thanks,

Using this php to show a signup form in my template file:

<div style="border: 3px solid green; margin-top: 1em; height: auto">
<h2>Blog notifications</h2>
<?php echo do_shortcode('[forminator_form id="9979"]'); ?>
</div>

Looking like this:

https://drive.google/open?id=1CGHp6ezgzeyPtbjA3zhuNAQ9VmmUEjd3

That white block at the bottom is just another div that follows.

The shortcode is not being recognised by the div and is displaying outside it. Not sure why this is.

thanks,

Share Improve this question asked May 14, 2020 at 8:50 MatJonMatJon 174 bronze badges 2
  • try: <div style="border: 3px solid green; margin-top: 1em; height: auto; float: left; width: 100%;"> – DinhTv Commented May 14, 2020 at 9:05
  • DinhTv it worked: drive.google/open?id=13IzcPoGgaDEin06IEDL8atid5VvWgdmC although div that follows is coming up underneath – MatJon Commented May 14, 2020 at 11:25
Add a comment  | 

1 Answer 1

Reset to default 1

Maybe your form has a float property. So just add overflow hidden to parent div.

Take a look here: https://codepen.io/zecka/pen/jObvbmG

your code can be like that:

<div style="border: 3px solid green; margin-top: 1em; height: auto; overflow: hidden">
<h2>Blog notifications</h2>
<?php echo do_shortcode('[forminator_form id="9979"]'); ?>
</div>
发布评论

评论列表(0)

  1. 暂无评论