[Resolved] I’m trying to style file input button on cred form but I can’t reach it with CSS
This thread is resolved. Here is a description of the problem and solution.
Problem:
I am trying to style “Choose File” input button on CRED form but I can't modify it with CSS. I tried with custom css classes but it won't work. I tried applying style to classes that are already on it but I don't get the result I want. I can only change the surroundings of the Choose File button, but cannot modify the button itself.
Solution:
Changing form elements style can be hard at times, in this thread I have explained two methods to modify Choose File button inside a CRED form.
I am trying to style my input type file button, but I cannot change any of its settings. I tried with custom css classes but it won't work. I tried applying style to classes that are already on it but I don't get the result I want. I can only change the surroundings of the button, not button itself.
I also tried to place a label on top of it and "hide" the button itself, but in that case the repetition option and the delete file option are also gone, so that is not an option for me.
Thank you for contacting Toolset Support. To style the file input button you would need to use and target CSS as follows and add it in your CRED Form’s >> CSS editor. You can change CSS style properties as desired:
Thank you for your help, but it seems that the suggested solution did not solve my problem.
I still can't control how the button looks. No matter how I change the CSS style, the input button stays the same.
I looked up some websites which talk about pseudo elements on input fileds and everybody seems to agree that you are not even able to add pseudo elements on input fields: "Because these pseudo elements are only allowed to be used on container elements. So, elements like inputs, images and any other self closing element can’t use pseudo elements because they aren’t “container elements”. Meaning, they don’t allow any nested elements or content inside of them." (source: hidden link )
I also tried wraping <input> with <span> or <div> (with some help of JS) and change CSS sytle to it, but the button itself won't change. This also only changes the surroundings of the button.
I have noticed that you are using older versions of Toolset CRED, Types and Views. Please update ALL Toolset plugins to it's latest official release version. Or you can download it from your account: https://toolset.com/account/downloads/
After that if issue exists, we will be able to check further and in that case we may also need to request temporary WP admin login.
To debug this issue I will need to take a look at your setup. So I need to request temporary access (WP-Admin) to your site
– preferably to a test site where the problem has been replicated if possible –
in order to be of better help and check if some configurations might need to be changed.
Your next answer will be private which means only you and I have access to it.
=== Please backup your database and website ===
✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.
✙ Please add the Link to the [FORM] Edit Screen, [Page] Edit Screen where you have inserted this Form.
I've atached some screenshots that show how the suggested solution still won't help.
If I want to add more than one file the additional CSS does not work. If I decide to delete one of the files, the additional CSS also doesn't work. And somehow it only works nicely on Chrome.
Is there another solution that is maybe more efficient?
I have updated the CSS and fix this issue for Chrome. Please check here: hidden link
Firefox does not support this CSS style property. I will try to see if I can get a workaround solution for Firefox so that same style appears in Firefox browser as well.
Thank you for waiting on this. I am able to find an alternate solution so that it works in both browsers efficiently. I have completed this in 2 steps now:
1. First I have added some more CSS in the page editor CSS section, as follows:
2. And I have added buttons as CSS image sprites so that button can be customized in both browsers. Button Image file is added via Media Library, file path is: hidden link
==> I have created the button using Photoshop, the PSD and PNG files for button are here, you can modify the button image as desired: hidden link
I hope this resolves the issue, have a great day.
Thank you
hi dear,,
i want to use this code to customize file upload button in cred post form but it didn't show anything,,can you tell me what is the problem ,, i want to make it same in picture..thanks