You could use flexboxes, CSS-Grid or simply wrap all the boxes and declare them as inline-block and align them then with text-align.
Option #1: Flexbox
Here you wrap the textboxes and give them the wrapper display: flex; to declare everything as flex elements. Then you can use justify-content: center; to center them.
Same methode as #2a. However you use an unordered list as a wrapepr and instead of using divs you use the normal list items. The “list bullet” will eb removed with list-style-type: none;.
Is there an easier way to group all those mesageboxes and center them all at once? At the moment all the margin-left have been done by hand..
Thnx in advanced
Comments
Comment posted by El_Vanja
Seems like a purely design-related question. You might want to remove the
Comment posted by G-Cyrillus
Group them in a single container. From witch you can use flex and justify-content 😉 text boxes could also be inline boxes.(span instead div , if that makes sens for the contents. ) else ul-li would be fine here
Comment posted by Konrads
@G-Cyrilus gave you the answer broadly. Some code reuse could be obtained using a common class. At risk of sounding arrogant, I suggest picking up a decent book on modern web design. Good looking modern web is a little like making a complex dish – all the ingredients have to come out just right and it’s best when someone shows it to you.
Comment posted by G-Cyrillus
A list would be perfect i believe 😉
Comment posted by DarkSmile
Option #1 works great! thank you, am I understanding this right? If I have multiple boxes or other items that I want in one group I just create the class and put them all in the same class? As seen in your options?
Comment posted by tacoshy
@G-Cyrillus, yes which is rpetty much the same solution as inline-block. But I will add 😉
Comment posted by tacoshy
@DarkSmile, yes you wrap them. In eevry cases you have the elemetns (that youc all textboxes) are wrapped. childs dont need a seperate class msot of the time as you can select them through the parent. Int hsi case:
Comment posted by G-Cyrillus
?? ul/li and inline-block are two different language HTML/CSS 😉 , one is for the semantic (when tags have a meaning, exit div/span) , and the other one is for the styling of any tag and won’t modify the DOM/semantic at all 😉