javascript - 如何在 JSX 中将元素放置在页面底部?
问题描述
我想知道如何在 JSX 中实现这一点。我尝试如下使用 CSS 样式,但我想修复底部位置,同时从父级继承左侧。如果我不继承,则容器不会与我的其他组件保持一致。
<div className="container" style={{ position: "fixed", bottom: "10%", left: "want to inherit from parent element here" }}>
将不胜感激任何帮助!谢谢。
解决方案
<Router>
<div
className="container-fluid"
style={{
height: "100vh",
width: "100%",
backgroundImage: `url(${world_map})`,
backgroundSize: "auto",
}}
>
<NavBar />
<Switch>
<Route path="/" exact component={MainMenu} />
<Route path="/services" component={ServicesMenu} />
<Route path="/autoconnect" component={AutoConnectMenu} />
<Route path="/gatt" component={GATTMenu} />
<Route path="/characteristics" component={CharMenu} />
<Route path="/scan" component={ScanMenu} />
<Route path="/connect" component={ConnMenu} />
<Route path="/write" component={WriteMenu} />
<Route path="/notify" component={NotifyMenu} />
</Switch>
<div
className="container"
style={{ position: "fixed", bottom: "10px", left: "inherit" }}
>
<div className={"alert alert-" + this.state.msgType}>
<span
style={{
fontFamily: "helvetica",
fontWeight: "bold",
}}
>
Message from Base Station:
</span>
{this.state.msg}
</div>
</div>
</div>
</Router>
推荐阅读
- multithreading - [branch] 如何在 HLSL 中执行?
- mysql - MySQL - GROUP BY 不能使用多个 CASE WHEN 语句
- php - 我的注册页面引用而不是提交到数据库
- ruby-on-rails - 当我尝试使用 admin/test_email 测试电子邮件发送时,Redmine 中出现错误 500
- python - 在 Python 中使用矩阵求解线性方程
- flutter - 实现底部导航栏
- apache-spark - 在不使用 UDF 的情况下基于映射转换 Spark DataFrame 中的列
- sql - 将 SQL Server 2017 报告服务添加到 SQL 群集
- sql - 每行的列中的 SQL 总和值
- javascript - 使用 s3 上传图像时“缺少请求的请求令牌”