-2

So im making a website for a school project but i cant get some text on the right and left side i got in the center but i need some on the right and left side anyone who can help?

I have tried to search around google but i couldnt find something there could help me i have put the code into this post

<content>
<h1><p style="text-align:center">Formål</p></h1>
</content>

i want it to be like this

left side text --------------------center text--------------------------- right side text
asgaadadaggda --------------- anjnsaohfsnoh-----------------------snosnaojn

Nicoolsen
  • 1
  • 2
  • Possible duplicate of [CSS: Left, Center, & Right Align Text on Same Line](https://stackoverflow.com/questions/13694062/css-left-center-right-align-text-on-same-line) – Calvin Nunes Oct 02 '19 at 12:03

2 Answers2

3

You can use Flexbox:

content {
  justify-content: center;
  display: flex;
  width: 100%;
}

content p:nth-child(2) {
  flex-grow: 1;
  text-align: center;
}
<content>
  <p>Left</p>
  <p>Center</p>
  <p>Right</p>
</content>
BenM
  • 52,573
  • 26
  • 113
  • 168
0

You can do this with plain html and plain css

Try it out and experiment here https://jsfiddle.net/7kcaohbj/

There are plenty of other way how you can do this, the below sample is the easiest and most basic way how to do it.

HTML

<div class="container">
<div class="divs divleft">

a

</div> <div class="divs divcenter">

b

</div> <div class="divs divright">

c

</div>

CSS

.divs {
  float:left;
  width:33%;
  display: inline-block;
}
.divright {
  text-align: right;
}
.divcenter{
  text-align: center;
}
Dharman
  • 30,962
  • 25
  • 85
  • 135
Oliver M Grech
  • 3,071
  • 1
  • 21
  • 36