tailwindlabs / tailwindcss-custom-forms

A better base for styling form elements with Tailwind CSS.
https://tailwindcss-custom-forms.netlify.app/
MIT License
1.55k stars 73 forks source link

Display issue for select fields #41

Closed zamson closed 4 years ago

zamson commented 4 years ago

I'm having some styling issues with select fields. Using the example from the docs the fields does not get styled as expected. This is using tailwind, no other CSS or resets present. Any ideas?

Screenshot 2019-10-24 at 10 40 56

`

`

adamwathan commented 4 years ago

Can you share your tailwind config, PostCSS config, and the markup for the form? On Oct 24, 2019, 4:44 AM -0400, Andreas sandström notifications@github.com, wrote:

I'm having some styling issues with select fields. Using the example from the docs the fields does not get styled as expected. This is using tailwind, no other CSS or resets present. Any ideas? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zamson commented 4 years ago

I'm using the HTML from the docs:

  <span class="text-gray-700">Requested Limit</span>
  <select class="form-select mt-1 block w-full">
    <option>$1,000</option>
    <option>$5,000</option>
    <option>$10,000</option>
    <option>$25,000</option>
  </select>
</label>

Gatsby SASS (from gatsby-config):

    {
      resolve: `gatsby-plugin-sass`,  
      options: {  
        postCssPlugins: [require('tailwindcss')('./tailwind.config.js')],  
      },  
    },

Tailwind config:

    theme: {
      extend: {
        colors: {
          'greenpeace-green': '#66CC00',
        }
      }
    },
    plugins: [
      require('@tailwindcss/custom-forms'),
    ]
  }
adamwathan commented 4 years ago

Make sure you install autoprefixer and add it to your PostCSS config 👍 Styling custom form elements relies on the appearance: none property which currently requires vendor prefixes in all browsers, but we don't bake those vendor prefixes into Tailwind because we don't want to force all users to support the same browsers.

    {
      resolve: `gatsby-plugin-sass`,  
      options: {  
        postCssPlugins: [
           require('tailwindcss')('./tailwind.config.js'),
           require('autoprefixer'),
        ],  
      },  
    },
zamson commented 4 years ago

Thanks – It's working 🥳