Search code examples
jquerytwitter-bootstrapjspbootswatch

bootswatch slate theme -- file upload "text" does not work


I am trying to use

https://bootswatch.com/slate/

I have file upload jsp, I think the functionality works but view/visually it is not working.

<html>

<Head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>

  <link href="https://bootswatch.com/slate/bootstrap.min.css" rel="stylesheet" type="text/css" />
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
</head>

<body>
  <form id="testf" method="post" enctype="multipart/form-data" action="x.do">
    <div class="col-md-8">
      <label>Browse
        <div class="text-warning">
          <input id="uploadfile" name="uploadfile" type="file" accept=".csv">
          <div>
      </label>
      </div>
  </form>
</body>
</html>

In slate theme, I don’t see the text “No File Chosen”. and after selection I don't see text with "selected file name"

with exact same code, and vanilla bootstrap I can see those texts... can anyone help me understand how can I get that working in slate theme? as specially after the file is selected I need to show the name..


Solution

  • You just need to change the text color since the bootstrap default is rgb(51, 51, 51) and the Slate theme is using a dark color for it's body background (#272b30 / rgb(39, 43, 48)).

    CSS Example:

    input[type=file] { color: white; }
    

    Working Example:

    input[type=file] {
      color: white;
    }
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
    <link href="https://bootswatch.com/slate/bootstrap.min.css" rel="stylesheet" />
    
    <form id="testf" method="post" enctype="multipart/form-data" action="x.do">
      <div class="col-md-8">
        <label>Browse
          <input id="uploadfile" name="uploadfile" type="file" accept=".csv">
        </label>
      </div>
    </form>