如何显示HTML< FORM>作为内联元素? [英] How to display HTML <FORM> as inline element?

查看:249
本文介绍了如何显示HTML< FORM>作为内联元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个基本的html / css问题...

This is probably a basic html/css question...

我有一个简单的单按钮表单,我想在段落文本内显示。 / p>

I have a simple one-button form that I would like to display inline inside paragraph text.

<p>Read this sentence 
     <form style='display:inline;'>
     <input style='display:inline;' 
            type='submit' 
            value='or push this button'/>
     </form>.
</p>

即使form有style = display:inline属性,有没有办法摆脱它?

Even though form has style=display:inline attribute, I get a linebreak before the form. Is there a way to get rid of it?

可以在< p> p>

Can form elements appear inside <p>?

推荐答案

将表单标签移到段落外,并将边距/填充值设置为零:

Move your form tag just outside the paragraph and set margins / padding to zero:

<form style="margin: 0; padding: 0;">
  <p>
    Read this sentence 
    <input style="display: inline;" type="submit" value="or push this button" />
  </p>
</form>

这篇关于如何显示HTML&lt; FORM&gt;作为内联元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆