是否可以在< input>领域? [英] Is it possible to place a link inside <input> field?

查看:59
本文介绍了是否可以在< input>领域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在此处登录和注册链接?

 < input type =textclass = formcontrolvalue =请登录或注册以查看您的跟踪链接。> 


解决方案

< input> 元素可能没有关闭


文字/ HTML中的标签省略:

    


b 最重要的是,它是
互动内容,这意味着不允许包含< a> 元素(或任何其他交互式内容)。 < textarea> 也是互动式内容,因此下列不会工作

 < textarea>请< a ...>登录< / a>或< a ...>注册< / a>查看您的跟踪链接。< / textarea> 

如果您要为包含链接的字段使用占位符,元素看起来像< input> 元素:



  input,.input { border:1px solid#888; box-sizing:border-box;显示:block; font-family:sans-serif; font-size:14px; line-height:20px; margin:10px 0; padding:2px 5px; vertical-align:baseline; width:300px;}  

 < input type = value =看起来像一个输入/>< div class =input>看起来像一个输入,< a href =#>但不是< / a>< / div&  


Is it possible to place links on Login and on Register here?

<input type="text" class="formcontrol" value="Please Login or Register to view your tracking link.">

解决方案

The <input> element may not have a close tag

Tag omission in text/html:
    No end tag.

which means it may not contain HTML.

On top of that, it is Interactive Content, which means that it is not allowed to contain <a> elements (or any other Interactive Content). <textarea> is interactive content as well, so the following will not work either:

<textarea>Please <a...>Login</a> or <a...>Register</a> to view your tracking link.</textarea>

If you want to use a placeholder for the field that includes links, you'll need to style an element to look like an <input> element:

input,
.input {
  border: 1px solid #888;
  box-sizing: border-box;
  display: block;
  font-family: sans-serif;
  font-size: 14px;
  line-height: 20px;
  margin: 10px 0;
  padding: 2px 5px;
  vertical-align: baseline;
  width: 300px;
}

<input type="text" value="Looks like an input"/>
<div class="input">Looks like an input, <a href="#">but isn't</a></div>

这篇关于是否可以在&lt; input&gt;领域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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