Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Team

I am using css to wrap the div container on my credit card form, its not showing and there are no error, yet i have refreshed the browser. What exactly am i missing to achieve this?

What I have tried:

<!---Debit card information details form----->
				<div class="card-container">
    <div class="container">
        <div class="creditCardForm" style="display:none;">
            <div class="heading">
                <h1>Confirm Purchase</h1>
            </div>
            <div class="payment">
                <form>
                    <div class="form-group owner">
                        <label for="owner">Owner</label>
                        <input type="text" class="form-control" id="owner">
                    </div>
                    <div class="form-group CVV">
                        <label for="cvv">CVV</label>
                        <input type="text" class="form-control" id="cvv">
                    </div>
                    <div class="form-group" id="card-number-field">
                        <label for="cardNumber">Card Number</label>
                        <input type="text" class="form-control" id="cardNumber">
                    </div>
                    <div class="form-group" id="expiration-date">
                        <label>Expiration Date</label>
                        <select>
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>
                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                        <select>
                            <option value="16"> 2016</option>
                            <option value="17"> 2017</option>
                            <option value="18"> 2018</option>
                            <option value="19"> 2019</option>
                            <option value="20"> 2020</option>
                            <option value="21"> 2021</option>
                        </select>
                    </div>
                    <div class="form-group" id="credit_cards">
                        <img src="img/visa.jpg" id="visa">
                        <img src="img/mastercard.jpg" id="mastercard">
                        <img src="img/amex.jpg" id="amex">
                    </div>
                    <div class="form-group" id="pay-now">
                        <button type="submit" class="btn btn-primary" id="confirm-purchase">Confirm</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
HTML



//css file
.card-container {
       display: flex;
       justify-content: center;
       align-items: center;
       height: 100vh;
   }
Posted
Updated 22-May-23 23:11pm
Comments
Karthik_Mahalingam 23-May-23 0:01am    
<div class="creditCardForm" style="display:none;">

change it to display:block
Andre Oosthuizen 23-May-23 5:12am    
Sorry Karthik, did not try to hijack your answer, just posted it as the answer to close the thread.

1 solution

As per Karthik_Mahalingam,

All of your elements is enclosed inside this div -
<div class="creditCardForm" style="display:none;">

The style is set to not display hence the fact that you see nothing whilst the code is running fine as expected to. Change this to -
<div class="creditCardForm" style="display:block;">
 
Share this answer
 
Comments
Gcobani Mkontwana 23-May-23 7:12am    
Andre Oosthuizen i have tried that solution its not working, what i really want to see is the div card from creditcardForm inside
Richard Deeming 23-May-23 8:29am    
Works perfectly for me: Demo[^]

Unless you explain precisely what "not working" means, and what you have done to try to diagnose the problem, nobody can help you.
Gcobani Mkontwana 23-May-23 9:05am    
@Richard Deeming i am disagree to the solution, but the problem is. the form itself must not use on the style block for specific reason. The only thing i need is to use style none to hide other payment options for specific reason. rather the form itself should be wrapped around with div card while having these payment options available when selecting should prompt these forms. Hope make sense now.
Andre Oosthuizen 23-May-23 9:40am    
As long as you hide the main div containing your other divs, it will NOT show. Maybe use javascript to hide or show the main div 'creditCardForm'. Thanks Richard, same effect here when tested.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900