Padding?


#1

div {
height: 50px;
width: 100px;
border: 4px solid #FF0000;
border-radius: 5px;
background-color: #308014;
margin: 20px 50px 10px 5px
padding: 40px;
}

Error: Oops, try again. It looks like your padding-top isn't 40px.
Why isn't my padding working?


#2

you are missing a semi-colon at the end of the margin line


#3

Your padding is not working because instead of padding: 40px; you need padding-top:40px.


#4

I disagree with your answer, padding: 40px; is short for: padding: 40px 40px 40px 40px; which is the same as:

padding-top: 40px;
padding-right: 40px;
padding-bottom: 40px;
padding-left: 40px;

which means the padding-top is 40px, so that is fine


#5

Oh, ok! I thought that would not work! (。◕‿‿◕。)


#6

Same issue here. What should I do?


#7

posting your code so i can help, i can't work with i have the same problem


#8

I fixed it. lol, right?


#9

are u a bot or something?


#10

very good you fixed it, no, i am not a bot, what made you think that?


#11

you were there about 3 seconds after i posted it.


#12

I just got a notification from you just after i finished answering another post, call it luck


#13

oh. okay! that makes sense!


#14

Fixed:

HTML:

<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
		<div id="error"></div>
	</body>
</html>

CSS:

* {
	border: 1px dashed black;

}

div {
height: 50px;
width: 100px;
border: 4px solid #FF0000;
border-radius: 5px;
background-color: #308014;
margin: 20px 50px 10px 5px

}

#error {
padding-top: 40px;
padding-right: 40px;
padding-bottom: 40px;
padding-left: 40px; 
}

#15

that will work, you could also have simply added a semi-colon after margin: 20px 50px 10px 5px