在保持给定宽度的情况下,将h2标题移到屏幕右侧时出现问题。我尝试过display: flex和float: right,但我似乎想不出如何有效地将h2 div对齐到屏幕的右侧。我的代码在这里:
<div class="container">
<h1>Example Title</h1>
<h2>This is a test sentence to work on my html and css code.</h2>
</div
h2 {
width: 60%;
float: rig
汇总:我希望有两个文本块并排(包含在一个div中),这两个块通过flexbox管理。但是,它们的内容受到父display的div的影响。
(下面的代码在中)
为什么下面的代码
.flex {
display: flex;
flex-direction: row;
}
<div class="flex">
<div class="flex">
this is the content of the left box
</div>
<div class="flex">
我在CSS中的内容定位有问题。我想把我的内容和垂直定位。我试过使用柔性箱,但没有用。我知道什么是柔性盒,它的特性,但它对我不起作用。这是CSS和HTML代码。
HTML:
<div class="main-div">
<div class="container-1">
<h2>What is Your Age In Days?</h2>
<div class="flex-box-container-1">
<
我想更新我的标题使用flex框。我想要一个图标,然后在左边有4个标签链接,然后在右边有两个标签,里面有一个图像。当我去设置对齐自我的任何项目,它上下移动,而不是左和右,如我所期待的。请帮帮忙。
function renderSections() {
return sections.map((section, i) => {
let sect = section.toString();
if (i !== 0) {
return (
<p class
我花了几个小时试图让我的flex元素中的文本垂直对齐,但没有成功。感觉我遗漏了一些非常重要的东西!
HTML
<div class="flex-container">
<div class="flex-item">
test
</div>
<div class="flex-item">
test