html - 我的标题不在中心
问题描述
我完全肯定我的代码使我的标题位于我的文本框的中心,但是,它看起来不像!有人可以检查我的代码是否正确吗?
.container {
width: 95%;
margin: 0 auto;
}
.home-about-textbox {
background-color: #232323;
padding: 4em;
width: 100vw;
margin-left: -2.65%;
outline: 2px solid #00ff6c;
outline-offset: -2.5em;
color: #FFF;
}
.home-about-textbox h1 {
text-align: center;
color: #00ff6c;
}
<div class="container">
<section class="home-about">
<div class="home-about-textbox">
<h1>Who I am</h1>
<p>I'm a young website developer who focusses on primarily making websites that are proven to have a <strong>high conversion rate</strong> so that my clients can experience that feeling of <strong>ever increasing cash flow!</strong></p>
<p>I usually like to spend a lot of my freetime working on either: a client's website design, or my personal website design. I am never the 'second-best' when it comes to website design which is why I offer numerous <strong>free</strong> design revisions
upon submission!</p>
</div>
</section>
</div>
解决方案
width: 100vw
从.home-about-textbox
似乎已解决的问题中删除,不是吗?
.container {
width: 95%;
margin: 0 auto;
}
.home-about-textbox {
background-color: #232323;
padding: 4em;
margin-left: -2.65%;
outline: 2px solid #00ff6c;
outline-offset: -2.5em;
color: #FFF;
}
.home-about-textbox h1 {
text-align: center;
color: #00ff6c;
}
<div class="container">
<section class="home-about">
<div class="home-about-textbox">
<h1>Who I am</h1>
<p>I'm a young website developer who focusses on primarily making websites that are proven to have a <strong>high conversion rate</strong> so that my clients can experience that feeling of <strong>ever increasing cash flow!</strong></p>
<p>I usually like to spend a lot of my freetime working on either: a client's website design, or my personal website design. I am never the 'second-best' when it comes to website design which is why I offer numerous <strong>free</strong> design revisions
upon submission!</p>
</div>
</section>
</div>
推荐阅读
- c# - C# 7.0 独立丢弃混淆 | _ = FooTask() 和 _ = Task.Run(FooTask) 之间的区别
- ros2 - LGSVL 无效模拟
- android - 收到通知且应用程序在后台时如何在android中调用另一个活动
- ios - Google AdMob iOS - 没有可显示的广告
- mysql - 将列从 int 转换为 varchar(32) 时 SQL 语法错误?
- arrays - excel使用返回数组的函数
- sql - bigquery 使用正则表达式连接表
- angular - 在 Angular 组件的其余部分之前完全加载订阅
- c# - 如何使用 Mutex 解决可能的竞争条件
- python - 为什么 win32api.SendMessage 不能在某些应用程序中执行鼠标点击