当我检查网页(甚至是 stackoverflow)时,我总是看到
<style type="text/css">/* This is not a zero-length file! */</style>
<style type="text/css">/* This is not a zero-length file! */</style>
Run Code Online (Sandbox Code Playgroud)
(是的,两次)在<head>标签的底部。
它来自Chrome吗?重点是什么?
感谢其他人的回答。此代码由Instant Translate Chrome 扩展程序生成。
我想知道是否有人可以解释社交媒体丰富的预览如何定义选择哪个og:title。
我使用wordpress,对于某些页面,我会插入php echo字符串以将它们注入<head>。我选择这样做是为了将某些标题和说明更改为更多的商业文本。显而易见的是,有2个og:titlemeta标签;我注入了一个和Wordpress后端页面标题。
有人告诉我,顶部的第一个meta标签<head>将被选作meta标签,例如将其用于丰富的预览,但这似乎不再发生了。
以下是我目前的情况以及在中的元标记的确切顺序<head>:
<html>
<head>
<meta charset="UTF-8">
<title>EXAMPLE</title> // my injected and used by Google
<link rel="canonical" content="https://example.com">
<meta name="description" content="description">
<meta name="subject" content="example">
<meta name="og:image" content="/image.jpg"> // my injected and used by Social Media
<meta property="og:title" content="og:title #1"> // my injected og:title, but ignored
<meta property="og:description" content="description">
<meta property="og:url" content="https://example.com">
<meta name="twitter:title" content="EXAMPLE">
<meta name="twitter:description" content="description">
<link rel="alternate" href="https://example.com" hreflang="nl-nl">
<link rel="alternate" href="https://example.com" hreflang="nl-be">
<title>EXAMPLE</title> // default …Run Code Online (Sandbox Code Playgroud)点击按钮,我正在添加一个CSS <head>:
$("head").append("<link id='#color_1_css' href='" + newCssHref +"' type='text/css' rel='stylesheet' />");
Run Code Online (Sandbox Code Playgroud)
这增加了<head>:
<link id="#color_1_css" rel="stylesheet" type="text/css" href="http://domain.com/styles/colors/f69548/f69548.css">
Run Code Online (Sandbox Code Playgroud)
在另一个按钮单击我需要再次删除它.我尝试了以下内容,但由于某种原因无效:
$('html').on('click', '.clear-color-picker', function(events){
var id = $(this).attr('data-parentID').replace('background_color','');
$('#' + $(this).attr('data-parentID')).setColor('');
$('#' + id).css('background-color','');
if (id == 'main-color') {
console.log('clicked');
$('#color_1_css').remove();
}
})
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我已将此代码添加到带有 .php 扩展名的网页中
<?php include_once("cssheadertop.php")?>
<link rel="stylesheet" href="button.css">
<?php include_once("cssheaderbottom.php")?>
Run Code Online (Sandbox Code Playgroud)
现在,cssheadertop.php 包含以下代码
<head>
<meta charset="utf-8">
<title>8mags - CSS Lessons</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../bootstrap.min.css" media="screen">
<link rel="stylesheet" href="../../style.css">
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Coda' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
Run Code Online (Sandbox Code Playgroud)
cssheaderbottom.php 文件有以下代码
<style>
page specific style here.
</style>
</head>
Run Code Online (Sandbox Code Playgroud)
我想在中间添加元描述和元关键字标签
<?php include_once("cssheadertop.php")?>
Run Code Online (Sandbox Code Playgroud)
和
<?php include_once("cssheaderbottom.php")?>
Run Code Online (Sandbox Code Playgroud)
就像我添加的链接标签一样。
它会在渲染或 SEO 中造成任何问题吗?
我将在网站中安装一个横幅,其目标是整个网站的运行。横幅设置为position:fixed& bottom:0px,因此它将是底部的浮动横幅。
我的网站结构是一个公共的头文件,有很多对应不同页面的正文文件。
如果我把这个DIV放在公共头文件(该<head>部分)中,它会自动实现结果。但是,如果我把这个DIV放在body文件中(该<body>部分),我就必须一张一张地打开body文档并多次添加DIV。
我在网上看到,人们总是不建议在<head>节中放置DIV。我可以知道原因吗?有什么坏处吗?我自己测试了一下,好像没有太大区别。
我注意到很多网站使用它,没有关闭标签.
<script type="text/javascript" src="editor.js">
Run Code Online (Sandbox Code Playgroud)
这种风格也是推荐的,但更长:
<script type="text/javascript" src="editor.js"></script>
Run Code Online (Sandbox Code Playgroud)
我可以这样写吗?它有效还是有更好的方法?
<script type="text/javascript" src="editor.js" />
Run Code Online (Sandbox Code Playgroud)