+ 1
HOW TO ALIGN TEXT IN THE MIDDLE OF THE SCREEN
Not only center it but align as well
5 Answers
+ 2
There are default alert what we can use from javascript, but this can't be styled(at least I don't know it can)
You can make custom alert box, with data you need and position it with css.
It is centering div both vertically and horizontally. This method is used in near every website.
Here are 11 ways to do it:
https://blog.hubspot.com/website/center-div-css
+ 2
dam @dain that case you might have to create a div that spans the entire screen. Here is an example with a div with a class="center"
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
0
You can use an attribute iside your html tag
e.g
<h1 alignt="center"> My Header</h1>
The <center> tag is now considered deprecated. Although it may still work, it's expected to be removed in favor of using CSS.
0
Yeah but i wanna align it in the middle on the screen not middle-top you know
0
HTML
<div class="box">
<span>Hello</span>
</div>
CSS
.box {
position: absolute;
background-color: burlywood;
margin: 50%;
}