小编Jun*_*ior的帖子

如何与“writing-mode: sideways-lr”结合使文本水平和垂直居中?

我有一个 TD/DIV,里面有一些文字。我使文本显示在 TD/DIV 的中心。但我希望使用 使文本位于中心writing-mode: sideways-lr。我怎样才能做到这一点?

div {
  width: 200px;
  height: 100px;
  text-align: center;
  vertical-align: middle;
  border: solid;
  display: table-cell;
}

.side {
  writing-mode: sideways-lr;
}
Run Code Online (Sandbox Code Playgroud)
<div>My text</div>
<br>
<div class="side">My text</div>
Run Code Online (Sandbox Code Playgroud)

代码在这里

在此输入图像描述

css

6
推荐指数
1
解决办法
2084
查看次数

Chrome 浏览器:每次播放音频对象时获取 favicon.ico

我有这样的声音:

var sound_obj = document.createElement("audio");
sound_obj.src = "../sounds/clic.mp3";
sound_obj.volume = 0.10;
sound_obj.autoPlay = false;
sound_obj.preLoad = true;
sound_obj.type = 'audio/mpeg';

document.addEventListener("click", function(){
    sound_obj.play();
});
Run Code Online (Sandbox Code Playgroud)

一切都在所有浏览器上运行良好。但是在 Chrome 中,我看到每次点击时,Chrome 都会从站点请求 favicon.ico。每次。我做错了什么?

GET "https://mysite/favicon.ico".
Run Code Online (Sandbox Code Playgroud)

稍后编辑

它似乎与使用服务工作者('fetch')有关。这是我的版本:

const VERSION = 10;
const CACHE_NAME = 'mysite-cache-v-' + VERSION;

self.addEventListener('fetch', event => {
  // Let the browser do its default thing
  // for non-GET requests.
  if (event.request.method != 'GET') return;

  // Prevent the default, and handle the request ourselves.
  event.respondWith(async function() {
    // Try to get …
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome html5-audio service-worker

5
推荐指数
1
解决办法
815
查看次数

如何隐藏临时搜索栏?

我有一个包含浏览器的窗口.Up是一个工具栏.在窗口的底部是一个搜索栏.搜索栏有一个关闭按钮[x].当用户单击关闭按钮时,我希望该栏消失.我希望只有当用户按下CTRL + F时才显示该栏.我尝试使用.hide()命令连接关闭的butoon,但应用程序崩溃.我需要帮助.

在此输入图像描述

的.cpp

DocumentationWin::DocumentationWin (QWidget * parent){
    docs = new QTextBrowser( this );

    //Prepare toolbar
    toolbar = new QToolBar( this );
    //add stuff to toolbar


    //Prepare footer bar
    searchlabel = new QLabel(tr("Find in page:"),this);
    resultslabel = new QLabel("",this);
    searchinput = new QLineEdit();

    findprev = new QToolButton(this);
    findprev->setArrowType(Qt::UpArrow);
    connect(findprev, SIGNAL(clicked()), this, SLOT (clickFindPrev()));
    findnext = new QToolButton(this);
    findnext->setArrowType(Qt::DownArrow);
    connect(findnext, SIGNAL(clicked()), this, SLOT (clickFindNext()));

    QStyle *style = qApp->style();
    QIcon closeIcon = style->standardIcon(QStyle::SP_TitleBarCloseButton);
    QPushButton *closeButton = new QPushButton(this);
    closeButton->setIcon(closeIcon);
    closeButton->setFlat(true);
    connect(closeButton, SIGNAL(clicked()), …
Run Code Online (Sandbox Code Playgroud)

c++ qt qwidget

2
推荐指数
1
解决办法
96
查看次数