css 相关问题

CSS(层叠样式表)是一种表示样式表语言,用于描述HTML(超文本标记语言),XML(可扩展标记语言)文档和SVG元素的外观和格式,包括(但不限于)颜色,布局,字体和动画。它还描述了元素应如何在屏幕上,纸上,语音或其他媒体上呈现。

打印时将图像格式化为最大尺寸为1页

我正在开发一个显示聊天对话的 html 页面,我希望它能够支持打印机,以便可以轻松导出为 PDF。我的问题是长图像可以跨越多个...

回答 3 投票 0

如何在cakephp中内联文本框和按钮

我试图将文本框和提交按钮内嵌在默认布局页面的顶部以进行搜索,但提交按钮却落在文本框下方,弄乱了我的布局。我尝试...

回答 2 投票 0

从 HTML 表单获取用户输入

我希望能够获取用户在 HTML 表单中输入的输入,并能够稍后在我的网站上打印它们。我希望能够打印所有用户信息以及他们所做的选择...

回答 5 投票 0

如何通过后端动态设置元素的CSS样式? (用户自定义面板可更改其他网页的样式)

假设我们有一个包含多个页面的网站,还有一个用户帐户页面。用户在他的面板中有一个设置可以更改网站其他页面中某些部分的颜色/字体大小/样式等...

回答 1 投票 0

网格布局和剪辑路径帮助(中间图像消失)

我目前正在探索剪辑路径。我在网格布局和消失的图像方面遇到了一些麻烦。 我在名为 .gallery 的 div 中有三个图像。我希望他们: 并排显示...

回答 1 投票 0

引导模式打开时无法在输入类型=“文本”中键入(甚至无法聚焦)

我有一个 jquery 代码,它创建一个下拉菜单并将其精确放置在用户右键单击的位置。一切正常,除了一件事:我无法在输入字段中键入内容。 生成的dro...

回答 7 投票 0

卡片下方的按钮

我有产品卡,我想要产品卡,我想在它们下面添加一个“购买”按钮。但按钮不断向右移动。我如何放置一个按钮,以便每个按钮...

回答 1 投票 0

HTML5 - 保留 <img> 供以后使用

我正在建立一个网站,用户可以上传图片,然后就会显示出来。稍后我需要将此图像设置为他们的个人资料图片。这是我的代码: 我正在建立一个网站,用户可以上传图片,然后就会显示出来。稍后我需要将此图像设置为他们的个人资料图片。这是我的代码: <input id="inp" type='file' accept="image/*"onchange="readURL(this);" /><br> <img id="blah"/> <script type="text/javascript"> function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('#blah') .attr('src', e.target.result) .width(150) .height(150); }; reader.readAsDataURL(input.files[0]); } } </script> 我不太明白你的问题,你可以将数据保存在一个变量中,然后在必须发布图像时使用该变量,你应该避免将图像直接存储在数据库中,而是存储对它们的引用。 但是如果你想在选择图像后简单地显示图像,你可以这样做: let input = $('input'), img = $('img'), reader = new FileReader(); function readFile(e) { reader.onload = function(e) { img.attr('src', e.target.result) } reader.readAsDataURL(e.target.files[0]) } input.on('change', readFile) <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input id="inp" type='file' accept="image/*"/> <img/> 但是,如果您想将图像永久保存在数据库中,您将必须了解后端如何工作,并且可能需要设置一个 Restful API。

回答 1 投票 0

Bootstrap 5.3 tablist 里面<select><option>不能在除最新的firefox之外的其他浏览器上工作

除了 Mozilla Firefox 浏览器之外,我的以下代码无法正常工作。我正在使用 Bootstrap 5.3。任何人都可以帮助我制作带有选择选项的工作表格列表吗? 这是我的代码在

回答 1 投票 0

中心文件输入 - Html/Css

我正在使用 HTML、Javascript 和 CSS 构建一个网站,并且我有一个文件输入,但由于某种原因它不会完全居中。 身体 { 宽度:100%; 高度:100%; 保证金:自动; 文字...

回答 4 投票 0

Drop-shadow 在 iOS Safari 上无法正常工作

我已向复选框标签添加了阴影,以便在选中它们时出现阴影。它们在 chrome 上完美运行,但是当我在 mac 和 iPhone 上的 safari 上尝试它们时......

回答 2 投票 0

如何显示小数点下的单位(Woocommerce 价格)?

问题: 我需要在小数点下显示单位。 所以我使用以下代码分隔小数部分。 但它显示如下(单位位于价格旁边): 请让我知道如何...

回答 1 投票 0

如何在顺风的表格行之间添加空格?

我是顺风新手,尝试在表行之间添加空间。 我是顺风新手,正在尝试在表格行之间添加空间。 <table className="table-auto w-full shadow-md mt-5 rounded"> <thead className="bg-base-200 text-left text-gray-700 tracking-wider"> <tr> <th className="p-4 ">Chapter Number</th> <th className="p-4 ">Chapter Name</th> <th className="p-4 ">Added at</th> <th className="p-4 ">Status</th> </tr> </thead> <tbody> {chapters.map((chapter) => ( <tr className="bg-card mt-6 rounded" key={chapter.chapterNumber}> <td className="p-4">{chapter.chapterNumber}</td> <td className="p-4">{chapter.chapterName}</td> <td className="p-4">{chapter.addedAt}</td> <td className="p-4">{!chapter.published && 'Not published'}</td> </tr> ))} </tbody> </table> 这不会增加表格行之间的空间。 所以,我尝试在每一行上使用mt-6。没有效果。我见过类似的问题,并在这里使用了answer,并添加了border-spacing和border-seperate。所以,现在我的表行有这些类。<table className="table-auto w-full shadow-md mt-5 border-spacing-2 border-separate rounded"> 但这会导致所有元素周围增加空间。我不明白为什么表行会这样,并且不采用 margin 和 mt-6。但是如果我用 div 替换行,它会应用边距顶部。 例如: <div> <th className="p-4 ">Chapter Number</th> <th className="p-4 ">Chapter Name</th> <th className="p-4 ">Added at</th> <th className="p-4 ">Status</th> </div> <div className="mt-6 bg-card"> <th className="p-4 ">1</th> <th className="p-4 ">Chapter Name</th> <th className="p-4 ">04/2/2022</th> <th className="p-4 ">Not published</th> </div> <div className="mt-6 bg-card"> <th className="p-4 ">1</th> <th className="p-4 ">Chapter Name</th> <th className="p-4 ">04/2/2022</th> <th className="p-4 ">Not published</th> </div> 首先,您需要使用 table 标签上的 Tailwind border-separate 属性分割边框,然后添加 border-spacing-y-3,其中:y 是轴,number 是行之间的高度。 用于控制表格边框之间间距的实用程序。 Tailwind 文档 <script src="https://cdn.tailwindcss.com"></script> <table class="table-auto w-full shadow-md mt-5 rounded bg-black border-separate border-spacing-y-3"> <thead class="text-left text-gray-500 tracking-wider"> <tr> <th class="p-4">Chapter Number</th> <th class="p-4">Chapter Name</th> <th class="p-4">Added at</th> <th class="p-4">Status</th> </tr> </thead> <tbody class=""> <tr class="bg-card rounded text-gray-200 bg-neutral-900"> <td class="p-4">60001</td> <td class="p-4"></td> <td class="p-4">6/21/2022</td> <td class="p-4">Not published</td> </tr> <tr class="bg-card rounded text-gray-200 bg-neutral-900"> <td class="p-4">60001</td> <td class="p-4"></td> <td class="p-4">6/21/2022</td> <td class="p-4">Not published</td> </tr> </tbody> </table> 使用 border-seperate 和 border-spacing-y-4 仅添加垂直放大倍数。 <script src="https://cdn.tailwindcss.com"></script> <div class="bg-black"> <table class="table-auto w-full shadow-md rounded border-separate border-spacing-y-4"> <thead class="text-white text-left bg-gray-900 tracking-wider"> <tr> <th class="p-4 ">Chapter Number</th> <th class="p-4 ">Chapter Name</th> <th class="p-4 ">Added at</th> <th class="p-4 ">Status</th> </tr> </thead> <tbody class=""> <tr class="bg-stone-800 mt-6 text-white rounded" key={chapter.chapterNumber}> <td class="p-4">{chapter.chapterNumber}</td> <td class="p-4">{chapter.chapterName}</td> <td class="p-4">{chapter.addedAt}</td> <td class="p-4">{!chapter.published && 'Not published'}</td> </tr> <tr class="bg-stone-800 mt-6 text-white rounded" key={chapter.chapterNumber}> <td class="p-4">{chapter.chapterNumber}</td> <td class="p-4">{chapter.chapterName}</td> <td class="p-4">{chapter.addedAt}</td> <td class="p-4">{!chapter.published && 'Not published'}</td> </tr> <tr class="bg-stone-800 mt-6 text-white rounded" key={chapter.chapterNumber}> <td class="p-4">{chapter.chapterNumber}</td> <td class="p-4">{chapter.chapterName}</td> <td class="p-4">{chapter.addedAt}</td> <td class="p-4">{!chapter.published && 'Not published'}</td> </tr> <tr class="bg-stone-800 mt-6 text-white rounded" key={chapter.chapterNumber}> <td class="p-4">{chapter.chapterNumber}</td> <td class="p-4">{chapter.chapterName}</td> <td class="p-4">{chapter.addedAt}</td> <td class="p-4">{!chapter.published && 'Not published'}</td> </tr> </tbody> </table> </div>

回答 2 投票 0

Sass 中的图像路径中有变量吗?

我想要一个变量,其中包含 CSS 文件中所有图像的根路径。我不太清楚这在纯 Sass 中是否可行(实际的 Web 项目不是 RoR,所以不能使用

回答 5 投票 0

React:如何在卡片的地图功能中仅更改一张卡片的 CSS

我对React很陌生,正在尝试创建一个函数,从数组中映射屏幕上的5张卡,但只能更改被单击的卡的CSS。 导出默认功能项目...

回答 1 投票 0

如何确保响应式网站中不同屏幕尺寸的排版一致?

我正在开发一个响应式网站,我正在努力在各种设备和屏幕尺寸上保持一致的排版。当我调整浏览器窗口大小或在不同设备上查看网站时...

回答 1 投票 0

在 Wordpress 中使用 JavaScript 平滑显示/隐藏滚动的 div

我是js新手,我一直遇到使用js onscroll显示和隐藏div的问题。幸运的是我能够弄清楚这一点,但现在我的问题是当 div 显示和隐藏它时非常 ab...

回答 1 投票 0

从 CSS 按钮中删除轮廓[重复]

目前,我的下拉菜单中的按钮在每个按钮周围显示黑色轮廓(如图所示),但我正在尝试删除它们,以便按钮看起来与背景更加融合......

回答 1 投票 0

HTML 按钮的默认高度是多少?

我想让按钮高度比默认值稍大一点,但我不知道默认值是多少。我想让它变得动态,最好使用 % 或 vh/vw,这样它在每个

回答 2 投票 0

切换错误,斜向移动而不是直线移动

我正在研究切换,这是我的代码: 从“./Toggle.module.scss”导入样式; 导出默认函数 Toggle() { 返回 ( <> 我正在研究切换,这是我的代码: import style from "./Toggle.module.scss"; export default function Toggle() { return ( <> <input type="checkbox" id="toggle" className={style.toggle} /> <label htmlFor="toggle" className={style.label} /> </> ); } .toggle { height: 0; width: 0; opacity: 0; } .label { width:60px; height: 30px; border-radius:30px; display: block; background-color: #ebebeb; box-shadow: 1px 2px 5px 1px rgba(0,0,0,0.2) inset; left:10px; padding-left: 5px; position: relative; &::after { content: ''; position: absolute; width: 23px; height: 23px; border-radius: 50px; background-color: green; top: 50%; transform: translateY(-50%); transition: 0.3s; } } .toggle:checked ~ .label::after{ transform: translateX(32px); } 最初,旋钮完全位于开关内部的中心,但是当我单击它时,它会进行对角线移动,而不是向右直线移动。详情请参阅codesandbox。 https://codesandbox.io/p/sandbox/red-microservice-gq48pj?file=%2Fsrc%2Findex.js 您还需要将 translateY: -50% 添加到切换转换中,如果不这样做,该值将不会添加到转换中: .toggle { height: 0; width: 0; opacity: 0; } .label { width: 60px; height: 30px; border-radius: 30px; display: block; background-color: #ebebeb; box-shadow: 1px 2px 5px 1px rgba(0, 0, 0, 0.2) inset; left: 10px; padding-left: 5px; position: relative; &::after { content: ""; position: absolute; width: 23px; height: 23px; border-radius: 50px; background-color: green; top: 50%; transform: translateY(-50%); transition: 0.3s; } } .toggle:checked ~ .label::after { transform: translateX(32px) translateY(-50%); } 一种解决方案是: &::after { ... top: 4px transform: translateX(0); ... } .toggle:checked ~ .label::after { transform: translateX(28px); } 注意从translateY 到translateX,因为你是水平移动,所以根本不需要设置Y 轴。

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.