你何时应该使用另一个<p>...</p>而不是<br />标签的判决是什么?这种事情的最佳做法是什么?
我环顾四周寻找这个问题,但大部分写作似乎都有些陈旧,所以我不确定自那时起对这个话题的看法是否有所改变.
编辑:澄清问题,这是我正在处理的情况.你会使用<br>'s或<p>'s作为以下内容(想象它包含在主页上的div中):
欢迎来到主页.
看看我们的东西.
你真的应该.
现在,这些线在技术上不是"段落".那么你是否会通过在一个<p>带有<br>'s'的标签中包围整个块来标记这一点,或者<p>为每一行使用单独的?
Chris Coyier不久前写过,最好的标记rel='up'在一个<nav>部分中使用,但那是在2010年,他说这种方式当时还有争议.使用HTML5标记层次结构导航栏的最佳方法是什么?这是克里斯的推荐:
<nav>
<p>
<a href="/" rel="index up up up">Main</a> >
<a href="/products/" rel="up up">Products</a> >
<a href="/products/dishwashers/" rel="up">Dishwashers</a> >
<a>Second hand</a>
</p>
</nav>
Run Code Online (Sandbox Code Playgroud) 我已经在互联网上搜索了类似问题的人,但仍然没有解决方案.在将我的应用程序与Angular-Express-seed,Angular-Express-Master以及任何其他流行的示例进行比较时,似乎没有任何内容被破坏,但它只是不起作用.有没有人知道为什么会这样?
我将尝试在不删除可能有问题的代码的情况下备用细节:
/app.js
// All environments
app.set('views', __dirname + '/views');
app.set('port', process.env.PORT || 3000);
app.engine('.html', require('ejs').renderFile);
app.set('view engine', 'html');
app.set("view options", { layout: false });
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session(
{ secret: 'spunkydelicious',
cookie : {
maxAge: (3600000*24*7) // 1 week
}
}
));
app.use(passport.initialize());
app.use(passport.session());
app.use(require('express-jquery')('/jquery.js'));
app.use(express.static(path.join(__dirname, '/public')));
app.use(app.router);
...
app.get('/', index.index);
app.get('/partials/:name', index.partials);
app.get('*', index.index);
Run Code Online (Sandbox Code Playgroud)
其中index.index,index.partials等的'index'对应于:
/app/controllers/index.js
exports.index = function(req, res){
res.render('index');
};
exports.partials = function(req, res) {
var name = req.params.name;
console.log('Hurah!');
res.render('partials/' + name);
}; …Run Code Online (Sandbox Code Playgroud) 为什么即使在我确认我正在从非空数组中删除一个元素之后,Typescript 仍然警告我pop()可能会返回undefined?
type Person = {
name: string;
};
const people: Person[] = [{ name: 'Sandra' }];
if (people.length) {
const { name } = people.pop();
// TS Error: Property 'name' does not exist on type 'Person | undefined'.
}
Run Code Online (Sandbox Code Playgroud)
即使我做出更明确的保证,我也会得到同样的错误:
if (people.length > 0 && people[people.length - 1] !== undefined){
const { name } = people.pop();
// TS Error: Property 'name' does not exist on type 'Person | undefined'.
}
Run Code Online (Sandbox Code Playgroud) html5 ×2
angularjs ×1
arrays ×1
breadcrumbs ×1
express ×1
html ×1
markup ×1
node.js ×1
routing ×1
semantics ×1
sublimetext2 ×1
typescript ×1
views ×1