Need some help please! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Need some help please!

How do you place a digit '1' in the middle of a square? I can only center it at the top or along the bottom but I want it in the middle. Please share code.

19th May 2018, 7:36 AM
Ryan Els
Ryan Els - avatar
7 Answers
+ 2
Thanks Roel. But it is a little more complicated. I am dealing with a 3D cube animation. Need to adjust the digits on all sides under <p>.
19th May 2018, 7:49 AM
Ryan Els
Ryan Els - avatar
+ 2
Thanks Roel. I think that "center of square" code should work. Let me try it out. If I don't come right I will give you an example of the code to clarify. Really appreciate the willingness to help.
19th May 2018, 8:02 AM
Ryan Els
Ryan Els - avatar
+ 2
<div id="cube"> <div class="side1"><p>1</p></div> <div class="side2"><p>2</p></div> <div class="side3"><p>3</p></div> <div class="side4"><p>4</p></div> <div class="side5"><p>5</p></div> <div class="side6"><p>6</p></div> </div> Not working. I got the digits in this code. But I just can't seem to get them to sit in the middle.
19th May 2018, 8:21 AM
Ryan Els
Ryan Els - avatar
+ 2
.side1 { line-height: 20px; height: 200px; border: 1px solid black; text-align: center; } I got it thanks. I used the above code in case somebody else might need it 👍
19th May 2018, 9:44 AM
Ryan Els
Ryan Els - avatar
+ 1
you can do it like this square <br> <p>text</p> end of square and you can make the square so it exactly fits in the center
19th May 2018, 7:43 AM
Roel
Roel - avatar
19th May 2018, 7:48 AM
Roel
Roel - avatar
+ 1
can you show me a code or something what you already have?
19th May 2018, 7:52 AM
Roel
Roel - avatar