如何显示HTML
这可能是一个基本的html / css问题...
我有一个简单的一键形式,我想在段落文本内部显示。
<p>Read this sentence <form style='display:inline;'> <input style='display:inline;' type='submit' value='or push this button'/> </form>. </p>
即使表单有style = display:inline属性,我在表单之前得到一个换行符。 有没有办法摆脱它?
可以在
<p>
显示元素吗?This is probably a basic html/css question...
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>
Even though form has style=display:inline attribute, I get a linebreak before the form. Is there a way to get rid of it?
Can form elements appear inside
<p>
?
原文:https://stackoverflow.com/questions/1106720
更新时间:2023-05-20 20:05
最满意答案
你可以使用
css
绑定 。 它可以用两种方法。 使用动态类(或类列表):<li data-bind="css: name"></li>
或者使用与真实/伪造值绑定的各个类来指示是否应该从元素中添加/删除它们:
<li data-bind="css: { classOne: hasClassOne, classTwo: hasClassTwo }"></li>
You can use the
css
binding. It can be used two ways. Either with a dynamic class (or list of classes):<li data-bind="css: name"></li>
or with individual classes bound against truthy/falsy values to indicate whether that are should be added/removed from the element:
<li data-bind="css: { classOne: hasClassOne, classTwo: hasClassTwo }"></li>
相关问答
更多-
Knockout JS - 无容器控制使用模板打破Foreach(Knockout JS - Containerless Control Breaks Foreach using Template)[2022-09-18]
Knockout的“无容器控制流语法”使用注释作为“虚拟元素”。 他们仍然必须遵守元素规则。 这意味着开始和结束标记之间的HTML必须是完整的元素。 这就是层次结构如何发挥作用:来自data-bind函数的id(id from data-bind function)[2023-01-01]
这对你有用: court_a_touch_unit_1: function (e) { var id = e.sender.element.attr("id"); console.log(id); }, 或者如果使用data-id更容易,请使用: court_a_touch_unit_1: function () { var id = $(event.target).data('id'); console.log(id); },你可以使用css 绑定 。 它可以用两种方法。 使用动态类(或类列表): 或者使用与真实/伪造值绑定的各个类来指示是否应该从元素中添加/删除它们: You can use the css binding. It can be used two ways. Either with a dyna ...事实证明我犯了一个菜鸟错误。 这是工作代码:This plan is a draft!由于变量是由knockout组成的,因此需要PlanStateName上的括号来访问基础数据。 So it turns out I made a rookie mistake. Here's the working code: