Unable to align div to right side Flexbox

Nash Anderson

I'm having a bit of trouble trying to get my interface working

            <div class="tier" id="t1">
                <div class='title'>
                    <h3>Tier 1</h3>
                    <h3 class="price">$5</h3>
                </div>
                <div class='description'>
                    <ul>
                        <li>Soundboard Access</li>
                        <li>In-Game and Discord tag</li>
                        <li>VIP and Donator channel access</li>
                    </ul>
                </div>
            </div>

            <div class="tier" id="t2">
                <div class='title'>
                    <h3>Tier 2</h3>
                    <h3 class="price">$8</h3>
                </div>
                <div class='description'>
                    <ul>
                        <li><span>All Previous Perks</span></li>
                        <li>Create a poll once per week</li>
                        <li>Choose SCP of the Day once per week</li>
                    </ul>
                </div>
            </div>
.tier {
  border: 1px solid #007eff;
  padding: 10px;
  margin: 5px;
  border-radius: 10px;
  display: flex;
}

.title {
  margin-top: -10px;
  text-align: center;
}

.price {
  font-family: monospace;
  font-size: 40px;
  margin-top: -10px;
  margin-bottom: -3px;
  padding: 5px;
  border-top: 1px solid black;
}

.description {
  margin: 3px;
  text-align: end;
  align-self: flex-end;
}

This is so far what I have, and for the most part it works, but I am struggling to get .description to align to the right. I read the mozilla docs and I am supposed to be able to use align-self to move it to the end of the div, but that doesn't work. (does absolutely nothing)

Here is what it looks like right now: enter image description here

Here is somewhat how I'd like it to look: enter image description here

Any help is appreciated

Spectric

Apply justify-content:space-between to .tier.

As per MDN:

The items are evenly distributed within the alignment container along the main axis. The spacing between each pair of adjacent items is the same. The first item is flush with the main-start edge, and the last item is flush with the main-end edge.

.tier {
  border: 1px solid #007eff;
  padding: 10px;
  margin: 5px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
}

.title {
  margin-top: -10px;
  text-align: center;
}

.price {
  font-family: monospace;
  font-size: 40px;
  margin-top: -10px;
  margin-bottom: -3px;
  padding: 5px;
  border-top: 1px solid black;
}

.description {
  margin: 3px;
  text-align: end;
  align-self: flex-end;
}
<div class="tier" id="t1">
  <div class='title'>
    <h3>Tier 1</h3>
    <h3 class="price">$5</h3>
  </div>
  <div class='description'>
    <ul>
      <li>Soundboard Access</li>
      <li>In-Game and Discord tag</li>
      <li>VIP and Donator channel access</li>
    </ul>
  </div>
</div>

<div class="tier" id="t2">
  <div class='title'>
    <h3>Tier 2</h3>
    <h3 class="price">$8</h3>
  </div>
  <div class='description'>
    <ul>
      <li><span>All Previous Perks</span></li>
      <li>Create a poll once per week</li>
      <li>Choose SCP of the Day once per week</li>
    </ul>
  </div>
</div>

Este artigo é coletado da Internet.

Se houver alguma infração, entre em [email protected] Delete.

editar em
0

deixe-me dizer algumas palavras

0comentários
loginDepois de participar da revisão

Artigos relacionados

Css Flexbox Navbar Right Align

CSS align few items on both side with flexbox

Flexbox align column to the right if there is only one column

Align text to the right side of a button radio

How to align nav item to the right side in a navbar?

How to align differently a specific <div> in flexbox?

How to align Material Design Lite cards to right hand side

How to align the text on the right side of the value box in R shiny?

One div on the left side and two divs on the right side

Bootstrap 4 align-items-bottom dentro do div flexbox

Flexbox align-self está mudando a altura do div

Align first div to left with subsequent divs aligned right

How to right align a div with display inline-block?

How to place an element at the left and right side of overflowing div

How to display image on the right side of div without ruining flex layout?

How can i align the highchart legend pagination to right or left side of the legends?

How can I align my navbar items to the left and right side of the centered image?

How to align one div to the left and other to the right. At mobile, the right one goes up and the left goes down

Unable to show the message list in left and right side of the chat room, always showing all the message in left side(receiver side)

How TO - Align Images Side By Side

Flexbox vertical align overflow

Flexbox Content Align

Flexbox Rows Align Left

how to fetch database records as <div>s without changing fixed <div>s in left and right side?

align table footer right

Table text align right

JTable Right Align Header

Android Right Align TabWidget

Right align button in form

TOP lista

  1. 1

    Obtendo apenas o número de uma String C #

  2. 2

    como acessar a conexão do banco de dados em visualizações no codeigniter 4

  3. 3

    Como redimensionar tabelas geradas pelo Stargazer no R Markdown?

  4. 4

    recuperar valores em uma linha de dataframes com base no valor em outro

  5. 5

    Firebase Storage Web: como fazer upload de um arquivo

  6. 6

    为什么在使用argc和argv时不会出现分段错误?

  7. 7

    Como agrupar objetos em uma lista em outras listas por atributo usando streams e Java 8?

  8. 8

    Qual é a diferença entre o tamanho do passo e a taxa de aprendizado no aprendizado de máquina?

  9. 9

    Por que definir a variável como uma string vazia não é necessária em meu código?

  10. 10

    Insert a value to hidden input Laravel Blade

  11. 11

    Configure o coletor de arquivos Serilog para usar um arquivo de log por execução do aplicativo

  12. 12

    Como ler arquivos yaml em laravel?

  13. 13

    Série Fibonacci usando programação dinâmica

  14. 14

    Como adicionar elementos a um array multidimensional em PHP?

  15. 15

    How do I set an IronPython ctypes c_char_p pointer to an absolute address that is not a valid memory address to read from?

  16. 16

    Por que meus intervalos de confiança de 95% da minha regressão multivariada estão sendo plotados como uma linha de loess?

  17. 17

    Como faço para que um formulário no Access se torne uma janela pop-up?

  18. 18

    Como anexar um arquivo a um e-mail usando JavaMail

  19. 19

    Adicionar campos de texto dinâmicos por meio da seleção suspensa de componentes?

  20. 20

    如何使用SOM算法进行分类预测

  21. 21

    TypeError não capturado: não é possível atribuir a propriedade somente leitura

quentelabel

Arquivo