To target an element that has both classes border and top, you should use a single selector without space between the classes. You had '.border .top', it should be '.border.top' -
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Twoclasees</title>
<style>
.box {
width: 700px;
margin: 100px auto;
}
.border.top {
border-top: 4px solid #3a5a40;
}
</style>
</head>
<body>
<div class="box">
<div class="border top">
<p>Test</p>
</div>
</div>
</body>
</html>
See a working fiddle -
both classes border and top[
^]