我完全按照我想要的方式进行了定位,但是围绕 58 的圆圈应该是一个完美的圆圈,而是根据容器中的内容进行调整。我该如何解决这个问题?
这是它的样子https://i.stack.imgur.com/Tb75A.png 这是我需要它看起来像https://i.stack.imgur.com/LgQFI.png
这是 JSX
<div className="second-col-container">
<h2>Air Quality Index</h2>
<div className="mod-container">
<span className="index">58</span>
<div className="para-mod">
<span className="mod">Moderate</span>
<div>
Air quality is acceptable; however, for some pollutants there
may be a moderate health concern for a very small number of
people who are unusually sensitive to air pollution.
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS
.second-col-container {
background-color: white;
width: 250px;
grid-area: air-index;
margin-top: 20px;
border-radius: 10px;
}
.second-col-container h2 {
margin-bottom: 20px;
margin-left: 10px;
}
.para-mod { …Run Code Online (Sandbox Code Playgroud) 我想每 5 秒在 for 循环中返回从 5 到 0 的数组中的值。这是我的代码
function x() {
let array = [1,2,3,4,5,6,7,8]
let value = array.slice(0,5)
for(i = 5-1; i>=0; i--){
console.log(value[i])
}
setTimeout(x, 5000)
}
x()
Run Code Online (Sandbox Code Playgroud)
我的问题是,这每 5 秒返回 5,4,3,2,1。我希望它返回 5(wait 5sec) 4(wait 5sec) 3(wait 5sec) 等等...
而不是top和rightCSS 属性,我想用它 inset来定位元素。
例如,以下代码将元素放置在右上角:
.top-right {
top: 0;
right: 0;
}
Run Code Online (Sandbox Code Playgroud)
您将如何使用该inset属性实现相同的目标?我尝试过使用不同的方法,但无法弄清楚。
尽管我在下面的示例中将top和都设置right为 0 inset,但它不起作用:
.top-right {
inset: 0 0;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试在迁移中向外键添加 onUpdate onDelete 级联更改。我怎样才能做到这一点?
原始迁移,无级联
exports.up = function(knex) {
return knex.schema.createTable('invitations', (table) => {
table.integer('eventId').unsigned().notNullable();
table.foreign('eventId').references('id').inTable('events');
});
};
exports.down = function(knex) {
return knex.schema.dropTable('invitations');
};
Run Code Online (Sandbox Code Playgroud)
级联新迁移
exports.up = function(knex) {
return knex.schema.alterTable('invitations', (table) => {
table.foreign('eventId')
.onUpdate('CASCADE')
.onDelete('CASCADE')
.alter();
});
};
exports.down = function(knex) {
return knex.schema.dropColumn('invitations');
};
Run Code Online (Sandbox Code Playgroud)
新迁移引发错误“TypeError: table.foreign(...).onUpdate(...).onDelete(...).alter 不是函数”。在不回滚原始迁移的情况下执行此操作的正确方法是什么?
如何使用 Material ui 模态组件并仍然可以访问模态显示内容背后的背景?这可能吗?我知道您可以使用backgroundProps 更改背景颜色,但是有没有办法完全禁用背景,并且仍然能够在背景打开时在背景中编辑内容?
css ×2
html ×2
arrays ×1
flexbox ×1
javascript ×1
jsx ×1
knex.js ×1
loops ×1
material-ui ×1
node.js ×1
reactjs ×1
settimeout ×1