我开发了一个chrome扩展程序,其格式是位于用户窗口顶部的单杠形式。有点“像”它:
但这是将其作为扩展程序添加到Chrome时的样子(请参见右上角的图标):
怎么了
这是清单:
{
"manifest_version": 2,
"name": "CLAWS",
"description": "testing",
"version": "1.0",
"permissions": [
"tabs",
"https://google.com.br/"
],
"browser_action": {
"default_icon": "icone_app.png",
"default_popup": "HTML.html"
}
}
编辑:HTML代码:
<!DOCTYPE html>
<html>
<head>
<link href='CSS.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="barra"></div>
</body>
</html>
和CSS.css:
#barra{
background-color:red;
width:100%;
height:80px;
}
A popup window is it’s own window. So when #barra
specifies its width as 100%, it’s 100% of the popup window’s body element. But nothing makes the body take a particular size. For example, if I inspect your extension’s popup, Chrome tells me that the body element has a width of 9px, and margins of 8px on each side (set by the user agent style sheet). Your values may differ, but they won’t be much larger. If you want it to be wider, you’ll need to have CSS.css explicitly tell body how wide it should be, and not use percentages.
但是,如果您想在用户窗口的顶部放置一个栏,则不确定是否要使用浏览器操作。当浏览器动作失去焦点时,特别是当用户与网页进行任何交互时,它们就会关闭。相反,我认为您需要一个内容脚本,该脚本会将工具栏放在屏幕顶部(可能只是一些css:)body{border-top:80px solid red;}
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句