在HTML标题中,我有这个:
<head>
<title>Title</title>
<link href="styles.css" rel="stylesheet" type="text/css"/>
<link href="master.css" rel="stylesheet" type="text/css"/>
Run Code Online (Sandbox Code Playgroud)
styles.css是我的页面特定表.master.css是我在每个项目中使用的工作表来覆盖浏览器默认值.哪些样式表优先考虑?示例:第一张包含特定的
body { margin:10px; }
Run Code Online (Sandbox Code Playgroud)
和相关的边界,但第二个包含我的重置
html, body:not(input="button") {
margin: 0px;
padding: 0px;
border: 0px;
}
Run Code Online (Sandbox Code Playgroud)
从本质上讲,CSS的级联元素在样式表引用方面是否与在典型的CSS函数中一样?这意味着最后一行是显示的那一行?
我的网页包含:
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
<style type="text/css">
td {
padding-left:10px;
}
</style>
Run Code Online (Sandbox Code Playgroud)
引用的样式表包含:
.rightColumn * {margin: 0; padding: 0;}
Run Code Online (Sandbox Code Playgroud)
我在rightcolumnID中有一个表,我希望单元格有一点填充.但是,引用的样式表优先于内联样式.我通过视觉和Firebug看到了这一点.如果我关闭padding:0Firebug中的指令,则填充左边生效.
我怎样才能padding-left上班?
我正在尝试使用 ReactJS 和 TailwindCSS 创建一个设计系统。
我创建了一个Button具有基本样式的默认组件,如下所示:
import React from "react";
import classNames from "classnames";
const Button = React.forwardRef(
({ children, className = "", onClick }, ref) => {
const buttonClasses = classNames(
className,
"w-24 py-3 bg-red-500 text-white font-bold rounded-full"
);
const commonProps = {
className: buttonClasses,
onClick,
ref
};
return React.createElement(
"button",
{ ...commonProps, type: "button" },
children
);
}
);
export default Button;
Run Code Online (Sandbox Code Playgroud)
然后我在我的页面中使用Button:
import Button from "../src/components/Button";
export default function IndexPage() {
return ( …Run Code Online (Sandbox Code Playgroud) 当我将 Tailwind 添加到 React 项目时,它打破了现有的样式。
我希望只使用 Tailwind 类(如mb-3)作为快捷方式。
我没想到它会覆盖现有的样式,比如将按钮背景更改为透明。
我做错了吗?或者 Tailwind 是否故意覆盖样式?
编辑:
这就是我所说的:(来自node_modules\tailwindcss\src\css\preflight.css)

当我排除基础时,问题就消失了,即:
//@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
Run Code Online (Sandbox Code Playgroud)
编辑2:
找到解决方案了!
module.exports = {
corePlugins: {
preflight: false,
}
}
Run Code Online (Sandbox Code Playgroud) 在我的css文件中.a.b有.a .b什么不同?
这是一个简单的问题,但它总是让我生气.我尝试过,但想到我会在这里发布,以防这作为参考有用.
我的代码中有这种情况:
<!-- This is the global CSS file -->
<style type="text/css">
#show_div{
display: none;
}
</style>
<!-- This is the local CSS file (only in this page)-->
<style type="text/css">
#show_div{
/* However to disable display: none;*/
}
</style>
<body>
<div id = "show_div">
Text text
</div>
Run Code Online (Sandbox Code Playgroud)
我通常需要隐藏这个元素,但在一个页面上,我需要显示它.在全局css文件中,我有:
#show_div{
display: none;
}
Run Code Online (Sandbox Code Playgroud)
我怎么禁用display: none;?我不能使用jQuery,$('#show_div').show();(或JavaScript).
谢谢
如果你不明白我的问题,那么我道歉.我可以尝试再解释一下.
在我的应用程序中,我需要更改访问的链接的字体大小.我正在做的是
a:visited {
color: pink;
font-size:12px;
}
Run Code Online (Sandbox Code Playgroud)
但只有颜色变了.为什么字体大小不变?
我在同一个 Angular 项目中使用 Tailwind CSS 和 Bootstrap (ngx-bootstrap)。大多数情况下,他们相处得很好。然而,当涉及到填充和边距时,它们就像兄弟姐妹一样互相争斗。我想使用 Tailwind 进行填充,因为它是一致的。例如,类p-X是 X 乘以 0.25 rem,但是使用 bootstrap,它就到处都是。烦人的是Bootstrap!important到处放。
utilities.css来自Tailwind,_spacing.scss来自Bootstrap。
有没有方便的方法来解决这个问题?
我需要帮助,我的表边界表的css覆盖似乎不起作用.我正在尝试创建一个这样的表:
<table class="table table-bordered">
<tbody>
<tr>
<td>Collection 1</td>
<td>5</td>
</tr>
<tr>
<td>Collection 2</td>
<td>5</td>
</tr>
<tr>
<td colspan="2" class="no-line">-----------</td>
</tr>
<tr>
<td>Total </td>
<td>10</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
在CSS中,我尝试了所有可能的组合,只是为了检查哪些可行,但仍然没有删除边框.
.table-bordered > tbody > tr > td.no-line {
border:none !important;
border-right: none !important;
border-left: none !important;
border-top: none !important;
border-right-style: none !important;
border-left-style: none !important;
}
Run Code Online (Sandbox Code Playgroud)
请帮忙,非常感谢!:)
css ×9
tailwind-css ×4
css3 ×2
reactjs ×2
bootstrap-4 ×1
html5 ×1
javascript ×1
material-ui ×1
next.js ×1
overriding ×1
stylesheet ×1