父 div 内有 3 个 div display:flex。
我想为父 div 创建一个边框半径,但有些东西不起作用。
我的代码是:
<div style="height:50px;display:flex;width:500px;border-radius: 20px;">
<div style="height:50px;width:30%;background:red"></div>
<div style="height:50px;width:30%;background:blue"></div>
<div style="height:50px;width:40%;background:yellow"></div>
</div>Run Code Online (Sandbox Code Playgroud)
边界半径是不可见的。子容器可能具有边框半径width:0%,width:100%因此应将边框半径应用于父容器。
这怎么可能呢?
不确定我想要实现的目标是否可以使用 css 网格实现,但我当前的实现不起作用。下面是我想要实现的布局。红色框跨越两行。
#wrapper {
display: grid;
grid-template-columns: repeat(5, 90px);
grid-auto-rows: 50px;
grid-gap: 5px;
width: 516px;
}
.wide {
grid-row: 1 / 4;
grid-column: 3 / 5;
background-color: red;
}
.block {
background-color: grey;
}Run Code Online (Sandbox Code Playgroud)
<div id="wrapper">
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block wide"></div>
<div class="block"></div>
<div class="block"></div>
<div class="block"></div>
</div>Run Code Online (Sandbox Code Playgroud)
ive started making a HTML/CSS/Vanilla JS web component library, and so far everything is going great. im using the typical ::part and all that, but i stumbled accros ::theme selector aswell, which is supposed to give quick access to styling without a creator having to set up more than necesarry.
problem is, i - whatever ive tried - can't seem to the get the ::theme selector work, is there anyone who can help me out ?
screendump is from https://meowni.ca/posts/part-theme-explainer/ …
我试图获取左侧的文本和右侧的图标,但现在图标位于文本上方,请参见第一张图片。我希望图标位于 \xe2\x80\x9c 项目名称\xe2\x80\x9d 右侧的右上角,并且文本与第二张图片类似。
\n<!-- Tailwind -->\n<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">\n\n\n<!-- Body -->\n<div class="flex card bg-neutral h-48 px-3 hover:bg-primary">\n <svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">\n <path stroke-linecap="round" stroke-linejoin="round" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />\n </svg>\n <h2 class="text-2xl font-bold text-white py-3">Project name</h2>\n <p class="text-left py-4 font-bold group-hover:bg-primary">Explaination of the project</p>\n <p class="text-left pb-4 font-bold">Tag, tag, tag</p>\n</div>Run Code Online (Sandbox Code Playgroud)\r\n将浏览器窗口重新缩放到非常小的尺寸时,总会有一些尺寸会导致右侧的文本由于自动换行而产生一些空间。如何将其与自动换行右对齐?
我尝试过的:
display: inline;
display: inline-block;
float: left;
white-space: nowrap; // not giving me the expected results as I want to keep the padding and the breaks
Run Code Online (Sandbox Code Playgroud)
.page-container {
padding: 160px 48px 48px 48px;
margin: 0 auto;
max-width: calc(1080px + 96px);
height: 90%;
width: 100%;
display: flex;
justify-content: end;
align-items: flex-end;
}
.title-container {
background-color: red;
max-width: 60vw;
text-align: left;
}Run Code Online (Sandbox Code Playgroud)
<div className="page-container">
<div className="title-container">
<h1>
Text <br /> More Text
</h1>
<br />
<h3>Item1 / Item2 / Item3 / …Run Code Online (Sandbox Code Playgroud)我的 CSS 网格表的列宽度不同,我想使用 CSS 网格复制表结构。
我之所以使用grid-auto-flow: column;,是因为在我的应用程序中,单元格是动态生成的,并且数量会有所不同。
代码: https: //jsfiddle.net/w8sdvnr7/1/
div {
display: grid;
grid-auto-flow: column;
}
p {
border: 1px solid red;
margin: 0;
}
table {
border-collapse: collapse;
}
td {
border: solid 2px red;
}Run Code Online (Sandbox Code Playgroud)
<h3>Not working: CSS Grid: The cells in the rows have different size.</h3>
<div>
<p>ABC</p>
<p>A</p>
<p>ABCDEFGHIJKLMNOP</p>
</div>
<div>
<p>ABCDEFGHIJKLMNOP</p>
<p>A</p>
<p>AB</p>
</div>
<hr>
<br>
<hr>
<h3>What I want: CSS Table: The cells in the rows have same size.</h3>
<table> …Run Code Online (Sandbox Code Playgroud)我想在同一垂直线上制作货币图标。
我想要的是:
我现在有什么:
.column {
display: flex;
flex-direction: column;
padding: 10px 10px 10px 0;
}
.cell {
text-align: right;
}Run Code Online (Sandbox Code Playgroud)
<div class="column">
<div class="cell">
<div class="item">
<span>123123 $</span>
</div>
<div class="item">
<span>(123 $)</span>
</div>
<div class="items">
<span>(1235 $)</span>
</div>
<div class="item">
<span>12414 $</span>
</div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
我想在我的页面中包含一个轮播,它不会滑动,只显示第一张图像。其他引导组件确实可以工作,这是我的代码:
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item">
<img src="./img/slider/slider1.png" class="d-block w-100 active" alt="...">
</div>
<div class="carousel-item">
<img src="./img/slider/slider2.png" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="./img/slider/slider3.png" class="d-block w-100" alt="...">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>Run Code Online (Sandbox Code Playgroud)
我从引导文档中逐字复制粘贴,但它仍然不起作用。
我正在尝试使用 CSS 在 HTML 段落的边距内编写一个短标签,其方式与 HTML 列表项的标记方式类似。我认为这样做的方法是使标签成为一个绝对定位的内联块,该块在边距内移动(请参见下面的 HTML+CSS 代码)。这按我的预期工作,只是我找不到将标签文本的基线与相应段落的第一行对齐的方法。
\nHTML+CSS 代码:
\n.labeled {\n margin-left: 40px;\n position: relative;\n}\n\n.labeled::before {\n display: inline-block;\n content: attr(data-label);\n position: absolute;\n width: 40px;\n left: -40px;\n /* How to vertically position so paragraph and label have same baseline? */\n}Run Code Online (Sandbox Code Playgroud)\r\n<p class="labeled" data-label="L">Lorem ipsum<sup>SUPERSCRIPT</sup> dolor sit amet, consectetur adipiscing elit. Ut cursus sem in nisl pulvinar porta. Praesent laoreet nisl sit amet sagittis mollis. Aliquam sit amet erat vitae enim ullamcorper dapibus ut vel …Run Code Online (Sandbox Code Playgroud)当选择输入时,我需要更改输入(单选类型)的父 div 的背景颜色,但是,如果用户选择另一个输入,则原始 div 需要返回到其原始颜色,并更改 div新选择的输入。到目前为止,我只创建了一个根据所选输入更改 div 颜色的函数,因此如果我单击另一个输入,两个 div 的颜色都会更改。我为此寻找了解决方案,但找不到任何解决方案。到目前为止,代码是这样的:
function changeBg(posicao) {
var changer = document.getElementById(posicao);
if (changer.checked = true) {
changer.style.backgroundColor = "#FFCE00";
}
}Run Code Online (Sandbox Code Playgroud)
<div class="posicao" id="um">
<input class="input-posicao " onclick="changeBg('um')" name="posicao" value="um" type="radio">
</div>
<div class="posicao" id="dois">
<input class="input-posicao " onclick="changeBg('dois')" name="posicao" value="dois" type="radio">
</div>
<div class="posicao">
<input class="input-posicao" onclick="changeBg('tres')" name="posicao" value="tres" type="radio">
</div>
<div class="posicao">
<input class="input-posicao" onclick="changeBg('quatro')" name="posicao" value="quatro" type="radio">
</div>
<div class="posicao">
<input class="input-posicao" onclick="changeBg('cinco')" name="posicao" value="cinco" type="radio">
</div>
<div class="posicao">
<input class="input-posicao" …Run Code Online (Sandbox Code Playgroud)您好,我在 HTML/CSS 中有一个非常简单的代码,我只想将名为 header1 的第一个块粘贴为蓝色,将 header2 粘贴为红色。我希望这两个块之间没有空白。
这是代码:
/* style22.css */
/* Définition des caractéristiques globales */
body {
background-color: #FFF;
font-weight: 400;
}
a {
text-decoration: none;
/ color: #FFF;
}
/* Header */
#conteneur {
display: flex;
flex-direction: column;
justify-content: center;
}
.header1 {
background: blue;
}
/* Navigation */
nav ul {
list-style-type: none;
display: flex;
background: red;
}Run Code Online (Sandbox Code Playgroud)
<header id="conteneur">
<div class="header1">
<div><a href="how.html"><span class="logo">ALGOBETTER</span></a></div>
</div>
<nav class="header2">
<ul>
<li><a href="gold_rules.html">Règles d'or</a></li>
<li><a href="pronos.html">Pronostics</a></li>
</ul>
</nav> …Run Code Online (Sandbox Code Playgroud)我想通过 javascript 更改我的 h1 边距,但它不起作用
我的代码:
<script>
document.getElementById("h1").style.marginLeft = "250px";
</script>
<h1 id="h1" style="position: absolute; text-align: center; top: 100px; color: #E95928; font-family:Helvetica; font-weight: bold; font-size:6vw; ">Shop till<br>you drop</h1>Run Code Online (Sandbox Code Playgroud)
html ×13
css ×12
javascript ×3
css-grid ×2
bootstrap-5 ×1
frontend ×1
shadow-dom ×1
tailwind-css ×1