Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Help with padding

malusuda

New Coder
HTML:
<!DOCTYPE html>
<html>
<head>
<style>
.cart {
  background-color: rgb(255, 216, 20);
  padding-left: 20;
  padding-right: 20;
  padding-top: 5px;
  padding-bottom: 5px;
  border-radius: 12.5px;
  transition: 0.15s;
  border: none;
}
.cart:hover {
  background-color:goldenrod;
}
</style>
</head>
<body>
<button class="cart">Add to Cart</button>
</body>
</html>

I made padding to left/right 20px but in browser it's only 6.
 

Attachments

  • Ekrano kopija 2023-05-01 140232.png
    Ekrano kopija 2023-05-01 140232.png
    8.2 KB · Views: 1
  • Ekrano kopija 2023-05-01 140258.png
    Ekrano kopija 2023-05-01 140258.png
    4.9 KB · Views: 1
You forgot to add the px to the 'padding'

.cart {
background-color: rgb(255, 216, 20);
padding-left: 20px; // this dimension
padding-right: 20px; // this dimension
padding-top: 5px;
padding-bottom: 5px;
border-radius: 12.5px;
transition: 0.15s;
border: none;
}
 
HTML:
<!DOCTYPE html>
<html>
<head>
<style>
.cart {
  background-color: rgb(255, 216, 20);
  padding-left: 20;
  padding-right: 20;
  padding-top: 5px;
  padding-bottom: 5px;
  border-radius: 12.5px;
  transition: 0.15s;
  border: none;
}
.cart:hover {
  background-color:goldenrod;
}
</style>
</head>
<body>
<button class="cart">Add to Cart</button>
</body>
</html>

I made padding to left/right 20px but in browser it's only 6.
Hey there! Looks like @OldMan provided an an answer for you. Does this resolve your issue?
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom