+ 1

HOW TO ALIGN TEXT IN THE MIDDLE OF THE SCREEN

Not only center it but align as well

10th Oct 2022, 4:44 PM
dam
dam - avatar
5 ответов
+ 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
10th Oct 2022, 5:37 PM
PanicS
PanicS - avatar
+ 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%); }
11th Oct 2022, 7:14 PM
John Doe
John Doe - avatar
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.
10th Oct 2022, 8:01 PM
John Doe
John Doe - avatar
0
Yeah but i wanna align it in the middle on the screen not middle-top you know
11th Oct 2022, 6:20 PM
dam
dam - avatar
0
HTML <div class="box"> <span>Hello</span> </div> CSS .box { position: absolute; background-color: burlywood; margin: 50%; }
11th Oct 2022, 7:09 PM
SoloProg
SoloProg - avatar