Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The CSS below displays the following: https://imgur.com/LKOlxvD

I would like to update the code so small red text displays at the bottom of the section that has the "cc_icon.png" image, so it would look exactly like this: https://imgur.com/aqpepA3

Can somebody please tell me what code needs to be added to display the small red text on desktop and mobile?

CSS
.desktop .section-payment {
    width: 65% !important;
}
#pay-met-sec {
    display: block;
}

#pay-met {
    float: left;
    width: 48%;
    border: 1px solid rgba(226, 226, 226, 1);
    margin: 0 5px 5px 0;
    padding: 15px 10px 10px 10px;
}

.section-payment .section-body > div:first-child::after {
    content: url(image/payment/cc_icon.png);
}

.section-payment .section-body > div:nth-child(2)::after {
    content: url(image/payment/paypal_icon.png);
}

.section-payment .section-body > div:nth-child(3)::after {
    content: url(image/payment/ach60.png);
}

.section-payment .section-body > div:nth-child(4)::after {
    content: url(image/payment/check_icon.png);
}


What I have tried:

Tried adding the following code, but text wasn't displayed.

CSS
#pay-met::after {
    content: "3% transaction fee will be added to credit card sales";
    text-align: center;
    display: block;
    position: absolute;
    bottom: 5px; /* Adjust the spacing as needed */
    left: 0;
    width: 100%;
    font-size: 12px;
    color: red; /* Change the color to red */
}
Posted
Updated 13-Sep-23 6:41am
v3
Comments
Member 15627495 30-Aug-23 1:05am    
with after , you have X"::after" and X":after", it's two css version and features.

use 'another container' for your text, '::after' is bugy and not reliable ( you will get bad display in few web browser. too hard.

1 solution

Disclaimer: There is no html markup to see the structure of your section, so it makes it hard to give an accurate answer.

Did you use the bowser dev tools, find the pseudo element (::after) and see where the debugger is showing you where it is displayed?

position: absolute; requires a parent element with position: relative;. It will look up the dom until it finds one.

Also, is #pay-met the container div for all elements or just the Credit Card payment? The ::after pseudo element should be set within the Credit Card section. The element that the pseudo element should have: position: relative; for the position: absolute; to be applied within the element bounding box.
 
Share this answer
 

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