Like you see in inspector, you defined only border color but not border width. Because it is 0px, it is invisible ;)
You need to change it to
class="border border-gray-800"
"border" will by default mean border-width: 1px so if you need thicker use for example
class="border-2 border-gray-800"
or if you wanna it only on one side
class="border-right border-gray-800"
More in documentation.
Answer from chojnicki on Stack OverflowLike you see in inspector, you defined only border color but not border width. Because it is 0px, it is invisible ;)
You need to change it to
class="border border-gray-800"
"border" will by default mean border-width: 1px so if you need thicker use for example
class="border-2 border-gray-800"
or if you wanna it only on one side
class="border-right border-gray-800"
More in documentation.
Nothing was working for me until I added the border-style: solid using border-solid. I had to explicitly set border-0 though, else it will be applied to all directions.
<div className="border-0 border-b-2 border-solid border-b-red-600">Bottom border</div>
I am using "tailwindcss": "^3.3.3"
I'm a beginner to Tailwind, so it's likely something simple. I can see an <input type="text" class="border border-solid border-2 border-indigo-600">, but only a faint 1px border of #e5e7eb shows up. I can see that this is under the *, ::before, ::after rule at the top of the stylesheet. My config file is customized only for the content paths, and theme and extend are empty. I read quite a bit of the Tailwind documentation, but I'm having a lot of trouble wrapping my head around how basics like color intersect with border, background, and text seeing as the latter three all incorporate color.
I'm using the tab component from tailwind elements on a project i'm working on but I'm really struggling to change the bottom border color on the active tab (i.e. the tab you click to view the contents of the tab).
https://tailwind-elements.com/docs/standard/navigation/tabs/#section-related-resources
Whatever I try, the bottom border remains blue!
Does anyone have any idea where I can change it?
Simply use
@layer base {
*,
::before,
::after {
@apply dark:border-gray-600;
}
}
Because Tailwind implements border-color by default. It works!
Edit
If you use preflight: false, @layer base probably won't work. Try removing @layer base block and use it directly.
I figure out a way, hope it helps.
The tailwind suggests that we make use of index.css instead of configuring in tailwind.config.js
As mentioned in https://tailwindcss.com/docs/functions-and-directives
So the code goes like:
tailwind.config.js
const colors = require("tailwindcss/colors");
module.exports = {
mode: "jit",
darkMode: "media",
content: ["./src/**/*.{js,jsx}", "./public/index.html"],
theme: {
extend: {
colors: {
gray: colors.gray,
light: {
primary: colors.orange,
},
dark: {
primary: colors.green,
},
},
/* Add any default values here */
/* borderWidth: {
DEFAULT: "4px",
},*/
},
},
plugins: [],
};
index.css
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
/* Can directly apply colors : hard coded values for light and dark */
.bg-color {
@apply bg-white dark:bg-black;
}
/* Can use custom color defined in the tailwind.config.css file */
.bg-text {
@apply text-light-primary-800 dark:text-dark-primary-500;
}
/* This is how you apply the border-color for both light and dark mode */
.border-color {
@apply border-black dark:border-white;
}
}
DarkMode.js
import React from "react";
const DarkMode = () => {
return (
<div className=" min-h-screen min-w-full bg-color">
<div className="border-color border-4 bg-text font-bold">
Hello
</div>
</div>
);
};
export default DarkMode;
In light theme:
In dark theme:
For your desired border-color change the border-color property as shown below.
.border-color {
@apply border-gray-100 dark:border-gray-800;
}