Magento 2: Add CSS class for country input in address?
-
17-03-2021 - |
Question
In the address section at My account dashboard, there is a field called Country. I want to change the CSS for that country's input.
Where do I need to add CSS class in order to change it?
<div class="field country required">
<label class="label" for="country"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span></label>
<div class="control">
<?= $block->getCountryHtmlSelect() ?>
</div>
</div>
Any help will be appreciated!
Solution
You need not to add a new class in that select box. You can use the below class to change the CSS of the select country box on the account dashboard page.
.account .field.country select#country {
/* your CSS here */
}
Hope it helps!!!
OTHER TIPS
Where to place the css style is based on the type of change.
Reference to the Documentation
Check the theme enabled for your website you want to do these changes.
Magento\app\design\frontend\<theme>\*\web\css\blackdemo.css
Example: In my case it is.
Magento\app\design\frontend\Solwin\freego\web\css\blackdemo.css
add the style you want..
.account #country{
// place you styles here
}
Dont forget the cache Cache documentation
Through CLI: php magento cache:clean
Through admin:
Don't forget the cache Cache documentation