Nick Nick - 24 days ago 17
CSS Question

Multiple classes open, close only one

I used 2 classes in a div but want to close one of them first and close the other a little later in the code, is there any possible way? Facebook was just an example.



<body>
<header>
<div class="title titleborder">Dank nasty title</div class="title">
<a href="https://facebook.com" target="_blank">This is a link</a></div class="titleborder">
</header>
</body>




Answer

You can't use classes in closing HTML tags. Use a spantag for the inner class: (the CSS is just a random example to see the actual outcome of the different classes)

.titleborder {
  border: 2px solid red;
  }
.title {
  background: green;
  color: white;
  }
<body>
	<header>
		<div class="titleborder"><span class="title">Dank nasty title</span>
		<a href="https://facebook.com" target="_blank">This is a link</a></div>
	</header>
</body>

Comments