这是我在文件中的部分代码research.blade.php
<div class="research__text gap">
<h1 class="research__title">
@yield('research__title')
</h1>
<p class="research__subtitle">
@yield('research__subtitle')
</p>
</div>
这是文件中各部分的定义consulting.blade.php
<div class="section__content research__content">
@section('research__title')
Get to know how <br>
<span class="_yellow">we work</span> in one step
@endsection
@section('research__subtitle')
<button class="hover-white">Get a plan</button>
@endsection
@include('blocks.research') <!-- импортирование файла research.blade.php -->
</div>
如果是这样 - 一切正常,并且该部分的内容已正确research__subtitle放置p.research__subtitle。但是,如果我在节内添加带有任何内容的research__subtitle标签p,则该节的所有内容都research__subtitle不会放置在其父级中p.research__subtitle,而是放置在其父级div.research__text中。似乎将该部分的结束标记视为p.research__subtitle. 而对于其他标签,我还没有遇到过这个。这是为什么?
我使用laravel/framework版本9.2
如果我理解正确,那么问题不在于框架,而在于布局。即:当你试图
<p class="research__subtitle"></p>放置一个块元素时(标签<p>就是这样,标签<h1>也是,等等),根据W3C,标签<p class="research__subtitle"></p>会在另一个块元素开始的地方自动关闭。只允许在标签<p>中嵌入内置(inline')元素(<span>和<strong>其他)