我正在尝试减少与前端代码中的演示相关的html标记量.在我目前正在处理的表单中,我希望有2列表单字段.一种绝对可以做到我想要的方法是:
<html>
<head>
<style>
body {width:400px;}
.col {width:200px; height: 100px; float:left; display:block;}
label, input {display:block;}
</style>
</head>
<body>
<div class="col">
<label>Field1:</label>
<input>
</div>
<div class="col">
<label>Field2:</label>
<input>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我希望在浏览器中渲染时获得相同的结果,而没有标记中的div标记.所以我做了这样的事情:
<html>
<head>
<style>
body {width:400px;}
label,input {width:200px; height: 30px; float:left; display:block;}
</style>
</head>
<body>
<label>Field1:</label>
<label>Field2:</label>
<input>
<input>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这很接近,但我希望<label>标记标记出现在<input>代码中的每个标记标记之前,如下所示:
<label>field1</label>
<input>
<label>field2</label>
<input>
Run Code Online (Sandbox Code Playgroud)
但问题是我无法想象可维护的css代码会使标签出现在每个输入字段的顶部.是否有一种很好的方法可以使标记和渲染结果以我想要的方式显示?
我需要知道.html()当没有使用jQuery选择器设置id或类时,是否可以获得特定TH.
为了说明我的问题:
TABLE
THEAD TR
TH1 TH2 TH3
TBODY TR
TD1 TD2 TD3
Run Code Online (Sandbox Code Playgroud)
我设置了一个$('table tbody tr td')函数,可以在双击时将单元格转换为输入字段,然后返回模糊的文本,反映通过输入字段对单元格所做的更改.
我需要能够知道我正在访问哪个列.因此,如果有人双击TD2,我希望输入字段名称包含TH2.
如果没有为每个TH或TD设置id/class,请告诉我如何做到这一点.
OCaml手册描述了"约束"关键字,该关键字可用于类型定义.但是,我无法弄清楚使用此关键字可以实现的任何用法.这个关键字什么时候有用?它可以用于删除多态类型变量吗?(这样一个模型中的'at变为t,模块可以用在一个functor参数中,它需要t而没有变量.)
我想使用CSS在元素中间对齐一些文本.这是我的标记:
<div id="testimonial">
<span class="quote">Some random text that spans two lines</span>
</div>
Run Code Online (Sandbox Code Playgroud)
和相关的CSS:
#testimonial {
background: url('images/testimonial.png') no-repeat;
width: 898px;
height: 138px;
margin: 0 auto;
margin-top: 10px;
text-align: center;
padding: 0px 30px 0px 30px;
}
.quote {
font-size: 32px;
font-family: "Times New Roman", Verdanna, Arial, sans-serif;
vertical-align: middle;
font-style: italic;
color: #676767;
text-shadow: 1px 1px #e7e7e7;
}
Run Code Online (Sandbox Code Playgroud)
通常要进入.quote垂直中间#testimonial,我会这样做:
.quote { line-height: 138px; }
Run Code Online (Sandbox Code Playgroud)
但这会打破布局,因为文本.quote跨越多行.
正如你所看到的,我已经尝试过这样做vertical-align: middle;,但也无效.
任何帮助表示赞赏.干杯.
在阅读了这两篇文章(One Two)之后,我对如何覆盖所有平台和浏览器以获得最佳图标以供其使用感到困惑.
现在,我有这个,但我不确定这是否是最佳的.
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="/apple-touch-icon-152x152-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144x144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="/apple-touch-icon-120x120-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114x114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="/apple-touch-icon-76x76-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/apple-touch-icon-72x72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-precomposed.png">
<link rel="icon" href="/favicon.ico" sizes="16x16 32x32 48x48 64x64" type="image/vnd.microsoft.icon">
Run Code Online (Sandbox Code Playgroud)
我不确定apple-touch-icon-precomposed.png应该是什么尺寸.
但要切入追逐(tl; dr):什么是覆盖尽可能多的平台和浏览器的最佳方式以及推荐用于图标的大小?
Bounty将给予能够回答这两个问题的人:1.尽可能多地覆盖尽可能多的平台和浏览器的最佳方式是什么; 2.每次出现都需要哪些尺寸.
样式表
#firstblock { background: #000; float: left; }
.genblock { background: #006699; float: left; }
Run Code Online (Sandbox Code Playgroud)
HTML
<div id="firstblock"></div>
<div class="genblock"></div>
How you should do it
Run Code Online (Sandbox Code Playgroud)
要么
样式表
.left { float: left; }
#firstblock { background: #000; }
.genblock { background: #006699; }
Run Code Online (Sandbox Code Playgroud)
HTML
<div id="firstblock" class="left"></div>
<div class="genblock left"></div>
Run Code Online (Sandbox Code Playgroud) 在jQuery中创建JSON对象的最佳方法是什么(不使用解析器或AJAX)?
var JSONobj = new JSON({'a':'b'})
Run Code Online (Sandbox Code Playgroud) 我在MVC中创建自己的帮助器.但HTML中未添加自定义属性:
帮手
public static MvcHtmlString MenuItem(this HtmlHelper helper, string linkText, string actionName, string controllerName, object htmlAttributes)
{
var currentControllerName = (string)helper.ViewContext.RouteData.Values["controller"];
var currentActionName = (string)helper.ViewContext.RouteData.Values["action"];
var builder = new TagBuilder("li");
if (currentControllerName.Equals(controllerName, StringComparison.CurrentCultureIgnoreCase)
&& currentActionName.Equals(actionName, StringComparison.CurrentCultureIgnoreCase))
builder.AddCssClass("selected");
if (htmlAttributes != null)
{
var attributes = new RouteValueDictionary(htmlAttributes);
builder.MergeAttributes(attributes, false); //DONT WORK!!!
}
builder.InnerHtml = helper.ActionLink(linkText, actionName, controllerName).ToHtmlString();
return MvcHtmlString.Create(builder.ToString(TagRenderMode.Normal));
}
Run Code Online (Sandbox Code Playgroud)
CSHTML
@Html.MenuItem("nossa igreja2", "Index", "Home", new { @class = "gradient-top" })
Run Code Online (Sandbox Code Playgroud)
最终结果(HTML)
<li class="selected"><a href="/">nossa igreja2</a></li>
Run Code Online (Sandbox Code Playgroud)
请注意,它没有添加gradient-top我在helper调用中提到的类.
我是新手,通过html验证器运行我的代码.
关于我的导航,我收到一条消息:在这种情况下,元素ul不允许作为元素ul的子元素"
这是html结构:
<nav>
<div class="nav_container">
<ul class="navigation">
<ul class="logo">
<li><a href="index.htm"><img src="images/rh_logo_v5.png" alt="roundhaus logo"/></a></li>
</ul>
<ul class="subnav">
<li><a href="index.htm">home</a></li>
</ul>
<ul class="subnav">
<li><a href="reclaimedwood.htm">reclaimed wood</a></li>
<li><a href="design.htm">design</a></li>
</ul>
<ul class="subnav">
<li><a href="flooring.htm">flooring</a></li>
<li><a href="paneling.htm">paneling</a></li>
<li><a href="beams.htm">beams</a></li>
</ul>
<ul class="subnav">
<li><a href="shelving.htm">shelving</a>
</li><li><a href="mantels.htm">mantels</a></li>
</ul>
<ul class="subnav">
<li><a href="news.htm">news</a></li>
</ul>
<ul class="subnav">
<li><a href="woodtypes.htm">wood types</a></li>
<li><a href="phrases.htm">phrases</a></li>
</ul>
</ul>
</div>
</nav>
Run Code Online (Sandbox Code Playgroud)
它出什么问题了?它在浏览器中看起来很好.我应该关注还是采取行动?
我试图使用批处理文件复制命令提示符.我目前的代码转载如下.
@echo off
title Command Prompt
:LOOP
set /p COMMAND="%CD%>"
title Command Prompt - %COMMAND%
call %COMMAND%
echo.
title Command Prompt
goto LOOP
Run Code Online (Sandbox Code Playgroud)
但是,我有一个问题.如果我正在调用程序(例如gpedit.msc),则批处理文件将等待程序返回,然后继续执行,此时正常的命令提示符返回而不等待程序返回.
如何测试命令是否是程序,所以我可以使用start命令?
html ×5
css ×4
javascript ×2
jquery ×2
xhtml ×2
ajax ×1
asp.net-mvc ×1
batch-file ×1
c# ×1
favicon ×1
html-lists ×1
icons ×1
json ×1
navigation ×1
ocaml ×1
tagbuilder ×1
typing ×1
windows ×1