html form-inline,如何將HTML

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

這可能是一個基本的html/css問題……

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

我有一個簡單的單按鈕表單,我想在段落文本內顯示。

Read this sentence

type='submit'

value='or push this button'/>

.

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

盡管表單具有style=display:inline屬性,但我在表單之前獲得了換行符。有辦法擺脫它嗎?

Can form elements appear inside

?

表單元素可以出現在

中嗎?

6 个解决方案

#1

71

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

將表單標記移到段落外,並將頁邊距/填充設置為0:

Read this sentence

#2

52

cannot go inside

, no. The browser is going to abruptly close your

element when it hits the opening

tag as it tries to handle what it thinks is an unclosed paragraph element:

不能進入

, no。瀏覽器會突然關閉

元素,當它點擊開始的標簽時,它試圖處理它認為是未關閉段落的元素:

Read this sentence

#3

19

You can try this code:

您可以試試下面的代碼:

User:

Password:

The important thing to note is the css style property in the

tag.

需要注意的是

標記中的css style屬性。

display:inline!important;

顯示:內聯!重要;

#4

6

According to HTML spec both

and

are block elements and you cannot nest them. Maybe replacing the

with would work for you?

根據HTML規范,

都是塊元素,不能嵌套。也許用替換

對你有用嗎?

EDIT: Sorry. I was to quick in my wording. The

element doesn't allow any block content within - as specified by HTML spec for paragraphs.

編輯:對不起。我的措詞很快。

元素不允許任何塊內容-如HTML規范為段落指定的那樣。

#5

0

You can accomplish what you want, I think, simply by including the submit button within the paragraph:

我認為,只要在段落中包含submit按鈕,就可以實現您想要的內容:

 
 

Read this sentence

#6

0

Just use the style float: left in this way:

使用樣式float:左:

Lorem Ipsum

Lorem Ipsum

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值