0

I am trying to make paragraph center

I am using card

I am trying margin-left and margin-right and padding-left and padding-right but not work properly

I am trying to make paragraph one line below the service

<div class="card" style="width: 70rem;margin-top:120px;margin-left:120px;">
    <div class="card-img-overlay d-flex flex-column">

        <div class="row">
            <img class="card-img-top" src="~/Graphics/homeiconservicepage.svg" style="width:25px;height:25px;" />
            <a href="@ViewBag.link">@ViewBag.text</a>
        </div>
        
        <div class="justify-content-center d-flex">
            <span> <text font-size:50px;"> @ViewBag.text </text></span>

        </div>

        <div class="justify-content-center d-flex" >
            <p>
                We enable organizations from startups to large enterprises
                to make their work environment more efficient.
            </p>
        </div>
    </div>
    <img class="card-img-top" src="https://images.unsplash.com/photo-1552519507-da3b142c6e3d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" style="width:1200px;height:400px;" alt="Card image">
</div>

Current Output

enter image description here

5 Answers5

1

I am on phone so I cannot use the snippet (Codepen: https://codepen.io/Maxigui/pen/NWrxwRg)

First thing would be to set flex-column in your card-img-overlay.

On last p I just set: class="mx-auto"

And if you want to set center, instead of align-items-center repoace that by justify-content-center (I did not do that)

I suggest you the below code:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">

<div class="card" style="width: 70rem;margin-top:120px;margin-left:120px;">
    <div class="card-img-overlay d-flex flex-column">

        <div class="row">
            <img class="card-img-top" src="~/Graphics/homeiconservicepage.svg" style="width:25px;height:25px;" />
            <a href="@ViewBag.link">@ViewBag.text</a>
        </div>
        
        <div class="justify-content-center d-flex flex-column m-auto">
            <span class="mx-auto"> <text style="font-size:50px;"> @ViewBag.text </text></span>
            <p>
                We enable organizations from startups to large enterprises
                to make their work environment more efficient.
            </p>
        </div>
    </div>
    <img class="card-img-top" src="https://images.unsplash.com/photo-1552519507-da3b142c6e3d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" style="width:1200px;height:400px;" alt="Card image">
</div>
MaxiGui
  • 6,190
  • 4
  • 16
  • 33
0

Use this:

  <p text style="color:black;margin-top:180px;padding-right:150px;padding-left:150px;text-align: center">
            We enable organizations from startups to large enterprises
            to make their work environment more efficient.
  </p>

Change the value of padding-right and padding-left according to your preference.

Ameya Uppina
  • 131
  • 1
  • 3
  • 13
0

Set style="text-align:center". It works for me.

<p style="text-align:center"> We enable organizations from startups to large enterprises to make their work environment more efficient.</p>
0

@niskuremdir, How about this does this work?

<span style="color:black;margin-top:180px;text-align:center">
<p>
We enable organizations from startups to large enterprises to make their work environment more efficient.
</p>
</span>

Try doing this with and without the <p> </p> and also try with both <div> </div> and <span> </span> If that works, then you can go ahead and try to add the left/right padding:)

Ameya Uppina
  • 131
  • 1
  • 3
  • 13
0

You've to give width and height to parent container of text.

<div class="card" style="width: 70rem;margin-top:120px;margin-left:120px;">
  <div class="card-img-overlay d-flex flex-column">
    <div class="row">
      <img class="card-img-top" src="~/Graphics/homeiconservicepage.svg" style="width:25px;height:25px;" />
      <a href="@ViewBag.link">@ViewBag.text</a>
    </div>
    <div class="d-flex flex-column justify-content-center align-items-center w-100 h-100">
       <div>
         <span> <text font-size:50px;"> @ViewBag.text </text></span>
       </div>
       <div>
          <p>
            We enable organizations from startups to large enterprises
                            to make their work environment more efficient.
          </p>
       </div>
    </div>
  </div>
 <img class="card-img-top" src="https://images.unsplash.com/photo-1552519507-da3b142c6e3d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" style="width:1200px;height:400px;" alt="Card image">
</div>
Rafee Shaik
  • 681
  • 4
  • 10