鸡鸭扣 2024-02-08 21:50 采纳率: 58.3%
浏览 13

vue页面文字自动左右翻转的问题

请问我这个Services.vue渲染出来的页面为什么会出现文字自动左右翻转的情况。
刚开始页面如下:

img

然后自己变成了:

img

我的代码为:

<template>
    <header>
        <Navbar></Navbar>
    </header>
    <main>
        <div class="container">
            <div class="destination__container">
                <img class="bg__img__1" src="../assets/bg-dots.png" alt="bg" />
                <img class="bg__img__2" src="../assets/bg-arrow.png" alt="bg" />
                <div class="content">
                    <h1>网站<br />小程序<br />APP开发<br /></h1>
                    <p>
                        26道严谨流程管控项目。
                    </p>
                    <button class="btn">了解更多</button>
                </div>
                <div class="destination__grid">
                    <div class="destination__card">
                        <img src="../assets/口腔检查平台内页.png" alt="destination" />
                        <div class="card__content">
                            <h4>数字化X射线口腔检查平台</h4>
                            <p>
                                为口腔医院专门打造平台,采用业界领先“金属伪影”检查算法赋能口腔检查领域。
                            </p>
                            <button class="btn">了解更多</button>
                        </div>
                    </div>
                    <div class="destination__card">
                        <img src="../assets/加油站网页登录页.png" alt="destination" />
                        <div class="card__content">
                            <h4>智慧加油站安全监测系统</h4>
                            <p>
                                配备可视化视频流监测网页和声光预警功能,一站式解决加油站作业中的安全隐患问题。
                            </p>
                            <button class="btn">了解更多</button>
                        </div>
                    </div>
                    <div class="destination__card">
                        <img src="../assets/智慧医疗内页.png" alt="destination" />
                        <div class="card__content">
                            <h4>腺样体辅助诊疗系统</h4>
                            <p>
                                从算法模型,到软件框架,再到硬件支持,我们提供了一体化系统性的解决方案。
                            </p>
                            <button class="btn">了解更多</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
</template>

<script>
import Navbar from '@/components/Navbar.vue';

export default {
    name: 'services',
    components: {
        Navbar
    }
}
</script>

<style>
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap");

:root {
    --primary-color: #00605f;
    --secondary-color: #017479;
    --text-dark: #0f172a;
    --text-light: #94a3b8;
    --white: #ffffff;
    --max-width: 1400px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Montserrat", sans-serif;
    background: linear-gradient(to right,
            rgba(2, 82, 89, 0.9),
            rgba(255, 255, 255, 0)),
        url("../assets/bg.avif");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

.container {
    max-width: var(--max-width);
    min-height: 100vh;
    margin: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}


.destination__container {
    position: relative;
    padding: 5rem 0 5rem 5rem;
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: center;
}

.bg__img__1 {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-100%);
    opacity: 0.6;
    z-index: -1;
}

.bg__img__2 {
    position: absolute;
    bottom: 2rem;
    right: 50%;
    transform: translateX(100%);
    opacity: 0.8;
    z-index: -1;
}

.content h1 {
    margin-bottom: 1rem;
    font-size: 4.5rem;
    font-weight: 800;
    color: var(--white);
}

.content h1 span {
    -webkit-text-stroke: 2px var(--white);
    -webkit-text-fill-color: transparent;
}

.content p {
    max-width: 350px;
    margin-bottom: 2rem;
    line-height: 1.5rem;
    color: var(--white);
}

.content .btn {
    padding: 0.75rem 2rem;
    outline: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    background-color: var(--secondary-color);
    cursor: pointer;
}

.destination__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.destination__card {
    height: 100%;
    background-color: var(--white);
    box-shadow: 2px 2px 20px rgba(0, 0, 0, 0.7);
}

.destination__card img {
    width: 100%;
}

.card__content {
    padding: 1rem;
}

.card__content h4 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
}

.card__content p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.5rem;
    color: var(--text-light);
}

.card__content .btn {
    padding: 0.5rem 1rem;
    outline: none;
    border: none;
    font-weight: 500;
    color: var(--white);
    background-color: var(--primary-color);
    cursor: pointer;
}

@media (width < 1200px) {
    .search {
        max-width: 235px;
    }

    .destination__container {
        grid-template-columns: 1fr;
    }
}

@media (width < 900px) {
    .nav__links {
        display: none;
    }

    .content h1 {
        font-size: 4rem;
    }

    .destination__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (width < 600px) {
    .search {
        display: none;
    }

    .destination__container {
        padding-left: 3rem;
    }

    .content h1 {
        font-size: 3rem;
    }

    .destination__grid {
        grid-template-columns: repeat(1, 1fr);
    }
}
</style>
  • 写回答

4条回答 默认 最新

  • 专家-郭老师 Java领域新星创作者 2024-02-08 21:51
    关注

    参考通义千问和郭老师的小迷弟雅思莫了-编写提供,主要是为了帮助您快速解决问题,如下回答,您可以参考下,如有问题,评论区留言。

    从您提供的代码来看,并没有发现直接导致文字左右翻转的样式设置。不过,根据您的描述和代码中的CSS样式,我推测可能是因为.bg__img__1.bg__img__2 这两个图片元素设置了绝对定位以及translateX属性,当页面渲染或者窗口大小发生变化时,由于某种原因(例如动画效果或其他交互影响)可能导致整个布局出现问题,间接影响到了文字的显示位置,给人一种文字左右翻转的感觉。

    为了进一步排查问题,请确认一下以下几点:

    1. 是否在其他CSS文件或者全局样式中对文字有特殊的翻转或变换样式定义?
    2. 是否在JavaScript或者其他Vue组件中有动态改变布局或文字方向的逻辑?
    3. 检查浏览器开发者工具中是否有动态添加或修改样式的CSS规则。
    4. 观察不同屏幕尺寸下是否触发了媒体查询@media规则,导致样式变化。

    如果以上检查均无异常,建议提供更多关于问题出现条件的详细信息,以便进行更准确的分析。

    评论

报告相同问题?

问题事件

  • 创建了问题 2月8日

悬赏问题

  • ¥20 Html备忘录页面制作
  • ¥15 黄永刚的晶体塑性子程序中输入的材料参数里的晶体取向参数是什么形式的?
  • ¥20 数学建模来解决我这个问题
  • ¥15 计算机网络ip分片偏移量计算头部是-20还是-40呀
  • ¥15 stc15f2k60s2单片机关于流水灯,时钟,定时器,矩阵键盘等方面的综合问题
  • ¥15 YOLOv8已有一个初步的检测模型,想利用这个模型对新的图片进行自动标注,生成labellmg可以识别的数据,再手动修改。如何操作?
  • ¥30 NIRfast软件使用指导
  • ¥20 matlab仿真问题,求功率谱密度
  • ¥15 求micropython modbus-RTU 从机的代码或库?
  • ¥15 django5安装失败