It's about the "display"


#1

I
The instruction asked me to set the display of all divs to block and I did .But I don't know what wrong it is with my code.please help me and thanks.


Replace this line with your code. 
div {
    display:block;
	height: 50px;
	width: 100px;
	border: 2px solid black;
	border-radius: 5px;
	/*Add your CSS here!*/
	
}


#2

Please share the lesson number or paste the whole code. :slight_smile:


#3

The class is" HTNL&CSS - CSS Positioning ,2 Takeing up space ".

And my code is here:

`DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>Result</title>
	</head>
	<body>
		<div id="one"></div>
		<div id="two"></div>
		<div id="three"></div>
		<div id="four"></div>
	</body>
</html>`

* {
	border: 1px dashed blue;
}

div {
	height: 50px;
	width: 100px;
	border: 2px solid black;
	border-radius: 5px;
	/*Add your CSS here!*/
	display:block;
}

#one {
	background-color: #FF0000;
}

#two {
	background-color: #0000FF;
}

#three {
	background-color: #FFD700;
}

#four {
	background-color: #308014;
}

#4

Got no errors with your code - maybe, it's lvl. 3? :slight_smile: Because it looks like lvl. 2, but in lvl 3 you need
display: inline-block;


#5

Thanks,but it still didn't work.


#6

This worked well for me:

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

* {
	border: 1px dashed blue;
}

div {
    display: block;
	height: 50px;
	width: 100px;
	border: 2px solid black;
	border-radius: 5px;
	/*Add your CSS here!*/
	
}

#one {
	background-color: #FF0000;
}

#two {
	background-color: #0000FF;
}

#three {
	background-color: #FFD700;
}

#four {
	background-color: #308014;
}

#7

it should be like this.

div {
height: 50px;
width: 100px;
border: 2px solid black;
border-radius: 5px;
display: block;

}

You have to write display property after removing this.. /*Add your CSS here!*/ Hope it will resolve your problem.:slight_smile:


#8

My code worked well, i'm not having any problems :smiley:


#9

It didn't work yet. Maybe it is my browser's problem.


#10

I just found someone had my problem,and he solved it.Maybe because I am in China.


#11

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.