首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我如何将雪佛龙移动到最右边与文本的距离?

我如何将雪佛龙移动到最右边与文本的距离?
EN

Stack Overflow用户
提问于 2022-09-01 11:59:18
回答 1查看 25关注 0票数 -1

怎么才能把按钮/雪佛龙转到最右边呢?

现在的情况:

我想让它看起来像:

我是用苗条的医生的手风琴做的。

任何帮助都是非常感谢的。

代码语言:javascript
复制
<script>
    import { slide } from "svelte/transition";
    export let entry
    let isOpen = false
    const toggle = () => isOpen = !isOpen
</script>
<style>
    button {
        border: none; 
        background: none;
        display:block; 
        color: inherit; 
        font-size: 16px; 
        cursor: pointer; 
        margin: 0; 
        padding-bottom: 0.5em; 
        padding-top: 0.5em;
        padding-left: 0;
    }
    ul {
        list-style-type: none;
        padding-left: 0;
    }
    li {
        font-size: 16px;
        font-weight: 300;
        
    }
    svg { 
        transform: rotate(90deg);
        transition: transform 0.2s ease-in;
        margin-right: 0;   
    }
    
    [aria-expanded=true] svg { transform: rotate(0.75turn); }
</style>
<button on:click={toggle} aria-expanded={isOpen}> {entry[0]}<svg style="tran"  width="20" height="20" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M9 5l7 7-7 7"></path></svg> </button>
{#if isOpen}
<ul transition:slide={{ duration: 300 }}>
    {#each entry[1] as item}
    <li>{item}</li>
    {/each}
</ul>
{/if}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-01 12:03:50

最简单的解决方案是使用flexboxspace-between

代码语言:javascript
复制
.accordion {
  display: flex;
  justify-content: space-between;
}
代码语言:javascript
复制
<div class="accordion">
  text
  <svg width="18" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
    <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
  </svg>
</div>

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73569001

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档