加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

HTML – 使用CSS中心Google表单

发布时间:2020-12-14 19:42:14 所属栏目:资源 来源:网络整理
导读:我在我的网站上嵌入了一个google表单,它包含在div中.我尝试用CSS中心,但它不起作用.有没有办法完成这项任务? 我的代码: #googleForm {margin-left: auto;margin-right: auto;} div id="googleForm" iframe src="https://docs.google.com/forms..../iframe/
我在我的网站上嵌入了一个google表单,它包含在div中.我尝试用CSS中心,但它不起作用.有没有办法完成这项任务?

我的代码:

#googleForm {
	margin-left: auto;
	margin-right: auto;
}
<div id="googleForm">	
  <iframe src="https://docs.google.com/forms....></iframe>
</div>

解决方法

您可以使用id googleForm将text-align:center添加到元素.您还可以安全地删除margin-left和margin-right:
#googleForm {
  /*margin-left: auto;/*
  /*margin-right: auto;*/
  text-align: center;
}
<div id="googleForm">
  <iframe src="https://docs.google.com/forms....></iframe>
</div>

如果你想使用margin:0 auto你必须设置元素的宽度:

#googleForm {
  width: 304px;
  margin: 0 auto;
}
<div id="googleForm">
  <iframe src="https://docs.google.com/forms....></iframe>
</div>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读