【问题标题】:Responsive Chrome Extension popup响应式 Chrome 扩展弹出窗口
【发布时间】:2016-07-06 09:31:51
【问题描述】:

我正在开发一个 chrome 扩展程序,并且我得到了一个 .psd 的设计。 我有所有图层的 px 值。 设计是在 1225X2019 屏幕上制作的,导致我的小屏幕上的弹出窗口、字体、边距、间距等太大。

在我的 css 文件中,我使用从设计中获得的 px 值,使用“Adobe Assets”。

我不明白为什么“元视口”行不能使其响应。对于间距和边距,我也尝试使用 Bootstrap 的网格 (class="col-md-1"),但它似乎没有任何效果。

这是我的 css 和 html 代码 sn-ps:

body {
  font-family: 'Source Sans Pro';
  width: 738px;
  background-color: #eceff1;
}
#Hired_RSS
/*Hired RSS*/

{
  padding-left: 46px;
  padding-top: 10px;
  background-color: #455a64;
  color: #ffffff;
  height: 77px;
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 37.5px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.937px;
  text-align: left;
}
#toolbar {
  background-color: #b0bec5;
  width: 738px;
  height: 67px;
}
#Feeds {
  margin-left: 47px;
  margin-right: 50px;
  background-color: #b0bec5;
  color: #455a64;
  font-family: 'Source Sans Pro';
  font-size: 31.25px;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.781px;
  text-align: center;
}
#Live {
  margin-right: 27px;
  font-family: 'Source Sans Pro';
  color: #eceff1;
  font-size: 31.25px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.781px;
  text-align: center;
}
#Researched {
  margin-right: 50px;
  font-family: 'Source Sans Pro';
  font-size: 31.25px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.781px;
  text-align: center;
}
#Settings {
  font-family: 'Source Sans Pro';
  font-size: 31.25px;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.781px;
  text-align: center;
}
#plus {
  padding-top: 5px;
  margin-right: 21px;
  margin-bottom: 97px;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" ; content="width=device-width, initial-scale=1">
  <script src="/libraries/js/jquery-2.0.3.min.js"></script>
  <!-- Cascading Style Sheets -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
  <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>

  <link rel="stylesheet" type="text/css" href="/libraries/css/popupstyle.css">
  <title>RSS Extension's Popup</title>
</head>

<body>
  <div id="Hired_RSS">Hired RSS
    <input id="plus" type="image" src="/libraries/clipboard/plus.png" style="float: right;">
  </div>
  <div id="toolbar">
    <span class="toolbar1" id="Feeds">Feeds</span>
    <span class="toolbar1" id="Live">Live  <kbd>10</kbd></span>
    <span class="toolbar1" id="Researched">Researched  <kbd>3</kbd></span>
    <span class="toolbar1" id="Settings">Settings</span>
    <br></br>
</body>

</html>

【问题讨论】:

  • 您可以通过固定大小、固定宽度或更小的边距来限制弹出窗口的大小。见参考:stackoverflow.com/questions/6160568/…
  • 感谢 gui47,但我的问题不在于弹出窗口的大小,而在于它对不同分辨率/屏幕大小的响应能力。我也想让字体大小/边距/间距更小。

标签: html css google-chrome-extension responsive-design viewport


【解决方案1】:

很久以前就有人问过这个问题,但由于我刚刚在谷歌上搜索过这个问题并且对没有答案感到沮丧,我想我会分享解决方案。

col-md-_ 在绝大多数情况下都不起作用,因为“md”类仅适用于特定大小的屏幕,而弹出窗口几乎可以肯定不是。请改用 col-xs-_。

有关尺寸的更多具体信息,请参阅引导 css 的媒体查询部分:http://getbootstrap.com/css/#grid-media-queries

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多