Comments (5)
absolute + margin
.container{
position:relative;
}
.content{
position: absolute;
top: 0;
bottom:0;
right:0;
left: 0;
margin:auto;
}
from interview-question.
absolute + transform
.container {
position: relative;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
from interview-question.
flex
.container {
display: flex;
justify-content: center;
align-items: center;
}
.content {
text-align: center;
}
from interview-question.
grid
.container {
display: grid;
justify-items: center;
align-items: center;
}
.content {
text-align: center;
}
from interview-question.
css-table
.container {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.content{
display: inline-block;
}
from interview-question.
Related Issues (20)
- HTTP2和HTTP1有什么区别? HOT 1
- 谈谈对缓存的理解?
- 首屏加载优化有哪些?
- Node中的事件循环和浏览器中的事件循环有什么区别?
- 事件的捕获和冒泡机制了解多少? HOT 3
- 聊聊CSS盒模型 HOT 1
- get和post的区别?
- 如何判断一个浏览器是否支持webp 如何让IOS设备支持webp HOT 2
- oss存储的原理,访问一张图,怎么实现oss->cdn->client的?
- 移动端 1px 像素问题及解决办法 HOT 1
- 实现一个LRU缓存函数 HOT 1
- 什么是函数柯里化,如何实现? HOT 1
- webpack与grunt、gulp的不同? HOT 1
- Loader和Plugin的不同?
- webpack的构建流程是什么?
- 是否写过Loader和Plugin?描述一下编写loader或plugin的思路?
- webpack的热更新是如何做到的?说明其原理? HOT 1
- 如何利用webpack来优化前端性能?(提高性能和体验)
- 如何提高webpack的构建速度?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from interview-question.