Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Styling the "browse" button on a file upload field

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #153026
    gazmccarthy
    Participant

    I am having problems trying to style a button which is part of a file upload field…

    This is my code:

    <div id="DataUploadForm">
                @using (Html.BeginForm("Upload", "DataManagement", FormMethod.Post, new { enctype = "multipart/form-data" }))
                {
                    <fieldset>                    
                        <label for="file">Choose Data File: </label>
                        <input id="txtFileUpload" type="file" name="file" title="Click here to select a datafile." />
                        <input id="btnFileUpload" class = "bluBtn" type="submit" value="Upload" onclick="return FileUploadValidate();" title="Upload selected file to system." />
                    </fieldset>
    
                }
    </div>
    

    This is the upload field without any CSS
    http://img405.imageshack.us/img405/7818/1n8.png

    This is the upload field when I add my “bluBtn” CSS class http://img802.imageshack.us/img802/7522/1ld5.png

    How can I create CSS that will just target the browse button, and not the overall field?

    #153027
    Paulie_D
    Member

    I’m not sure you actually can without doing a hide and replace thing using javascript.

    http://geniuscarrier.com/how-to-style-a-html-file-upload-button-in-pure-css/

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.