form input styles doesn't work properly
See original GitHub issueForm input styles doesn’t work properly, sometimes it works, sometimes it doesn’t and sometimes it works partially.
Tested with the latest version of windicss
+ svelte-windicss-preprocess
on the latest version of SvelteKit
and Sapper
.
How to reproduce the issue:
1 - set all the files listed below
2 - $ npm run dev
3 - manually refresh the page
4 - $ npm run build && npm run start
5 - manually refresh the page
svelte.config.cjs:
const sveltePreprocess = require('svelte-preprocess');
module.exports = {
preprocess: [
sveltePreprocess.typescript(),
require('svelte-windicss-preprocess').preprocess({
config: 'tailwind.config.cjs',
compile: true,
prefix: 'css-',
globalPreflight: true,
globalUtility: true,
}),
],
kit: {
adapter: '@sveltejs/adapter-node',
target: '#svelte'
}
};
tailwind.config.cjs:
module.exports = {
purge: [],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [
require('windicss/plugin/forms')
],
}
src/components/Input.svelte:
<script>
let css;
export { css as class };
export let placeholder;
</script>
<input type="text" {placeholder} class="{css} border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm" />
src/routes/index.svelte:
<script>
import Input from '$components/Input.svelte';
</script>
<form action="">
<Input placeholder="component-input" class="block mt-1 ml-1 w-56" />
<input type="text" placeholder="normal-input" class="block mt-1 ml-1 w-56 border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm" />
</form>
screenshots:
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Input box style not working properly - css - Stack Overflow
I have centered my registration form. I have ...
Read more >Styling Form Inputs in CSS With :required, :optional, :valid and
We can use the :required , :optional , :valid and :invalid pseudo-classes coupled with HTML5 form validation attributes like required or pattern ...
Read more >How to style forms with CSS: A beginner's guide
You should now understand how to style simple form elements and how to use custom controls when browser input fields are difficult to...
Read more >6 Reasons - HTML5 Required Attribute Validation not Working
If the input elements aren't inside a form tag then HTML5 required attribute will fail to work. So always put input tags inside...
Read more >CSS Forms - W3Schools
CSS Forms · Styling Input Fields · Padded Inputs · Bordered Inputs · Colored Inputs · Focused Inputs · Input with icon/image ·...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
closing this in favor of https://github.com/windicss/svelte-windicss-preprocess/issues/32 as this is not special to this case, but seems to be generic to plugins
@alexanderniebuhr ok, let’s see if we can come up with a better solution. Thanks for your support! 😃