Странное наследование от элемента «a» в «figure» к элементу «p»

#css #inheritance

#css #наследование

Вопрос:

У меня действительно странная ошибка с наследованием в css. элемент p, который не находится внутри блока элементов «a», наследует свойства элемента «a» и странным образом превращает элемент «a».

 // !! IMPORTANT README:

// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place. 

/***********
INSTRUCTIONS:
  - Select the project you would 
    like to complete from the dropdown 
    menu.
  - Click the "RUN TESTS" button to
    run the tests against the blank 
    pen.
  - Click the "TESTS" button to see 
    the individual test cases. 
    (should all be failing at first)
  - Start coding! As you fulfill each
    test case, you will see them go   
    from red to green.
  - As you start to build out your 
    project, when tests are failing, 
    you should get helpful errors 
    along the way!
    ************/

// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!

// Once you have read the above messages, you can delete all comments.  
 @import url("https://fonts.googleapis.com/css?family=Lato|Roboto");
body {
  margin: 0;
}

#navbar {
  min-height: 90px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  background: #303841;
}
#navbar a {
  padding: 0 6vw;
  text-decoration: none;
  font: bold calc(20px   1vw) "Lato";
  color: #f6c90e;
  letter-spacing: 2px;
  text-shadow: 0 2px 0 black;
}

.container #welcome-section {
  background: #303841;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.container #welcome-section header {
  font-size: calc(20px   2vw);
  font-weight: bold;
  font-family: 'Lato';
  color: #f6c90e;
  letter-spacing: 4px;
  text-shadow: 0 2px 0 black;
  text-align: center;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
.container #welcome-section header p {
  margin-top: 0;
  color: #eeeeee;
}
.container #welcome-section header h1 {
  margin-bottom: 10px;
}
.container #projects {
  min-height: 100vh;
  display: flex;
  align-items: baseline;
  justify-content: space-evenly;
  flex-wrap: wrap;
  background: #3a4750;
}
.container #projects h2 {
  flex-basis: 100%;
  text-align: center;
  font-size: calc(20px   3vw);
  font-weight: bold;
  font-family: 'Lato';
  color: #eeeeee;
  text-decoration: underline;
  text-shadow: 0 2px 0 black;
}
.container #projects figure {
  width: 35vw;
}
.container #projects figure img {
  display: block;
  max-width: 100%;
  border-radius: 2%;
}
.container #projects figure a {
  text-decoration: none;
  display: block;
}
.container #projects figure figcaption {
  text-align: center;
  text-shadow: 0 2px 0 black;
  font: bold calc(15px   1vw) "Roboto";
  color: #f6c90e;
}

@media (max-width: 768px) {
  #navbar {
    justify-content: space-between;
  }

  #projects > * {
    flex-basis: 100%;
    padding-bottom: 10px;
  }
  #projects a {
    width: 75%;
    margin: 0 auto;
  }
}
@media (max-width: 768px) and (max-width: 576px) {
  #navbar {
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
  }
}  
 <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<!-- Navigation bar -->
<nav id="navbar">
	<a href="#welcome-section">About</a>
	<a href="#projects">Work</a>
	<a href="#">Contact</a>
</nav>

<!-- Main content -->
<main class="container">
	<section id="welcome-section">
		<header>
			<h1>Anıl Emek Türkeli</h1>
			<p>Frontend Developer</p>
		</header>
	</section>
	<section id="projects">
		<h2>All Works I've Done So Far         </h2>
		<figure class="project-tile">
			<a href="https://codepen.io/anilemek/full/VRmXqP" target="_blank"><img src="https://cdn1.imggmi.com/uploads/2019/3/12/f3614255ab87606e66bf5d449e194599-full.png"</a>
			<figcaption>Sass Technical Documentation Page</figcaption>
		</figure>
		<figure class="project-tile">
			<a href="https://codepen.io/anilemek/full/YgqoLa" target="_blank"><img src="https://cdn1.imggmi.com/uploads/2019/3/12/99066cf68f33649bc17562c4925c3afa-full.png"</a>
			<figcaption>Repedo Landing Page</figcaption>
		</figure>
		<figure class="project-tile">
			<a href="https://codepen.io/anilemek/full/BMbwXE" target="_blank"><img src="https://cdn1.imggmi.com/uploads/2019/3/12/626217cf51607a559f6a47fad499f355-full.png"</a>
			<figcaption>Repedo Survey Form</figcaption>
		</figure>
		<figure class="project-tile">
			<a href="https://codepen.io/anilemek/full/OddXaR" target="_blank"><img src="https://cdn1.imggmi.com/uploads/2019/3/12/1dbdcffbefc68964500597ec04e48e05-full.png"</a>
			<figcaption>Mustafa Kemal Atatürk's Tribute Page</figcaption>
		</figure>
	</section>
	<section id="contact">
		<p>Deneme</p>
	</section>
</main>  

https://codepen.io/anilemek/pen/PLjpQm

Кто-нибудь может объяснить, почему возникла эта проблема?

Спасибо.

Ответ №1:

Если речь идет о <p> с текстом Deneme внизу сайта, проблема в img тегах, которые были раньше. Вы должны закрыть их. Так, например, <img src="https://cdn1.imggmi.com/uploads/2019/3/12/626217cf51607a559f6a47fad499f355-full.png"/>