Align the unit without a specific width in the middle?

0 like 0 dislike
7 views
Link. The news block has no width and I want to align horizontally. How to do it?
by | 7 views

2 Answers

0 like 0 dislike
The news block is the width that it is 100%.
You can either align the content centered, or set the block width depending on the width of the content (10vw * 3) and align the block itself.
by
0 like 0 dislike
#news{ text-align: center; } #news{ position: absolute; left: 50%; transform: translateX(-50%); } #news{ display: flex; justify-content: center; }
by

Related questions

110,608 questions
257,186 answers
0 comments
33,901 users