letter 相关问题


CSS 伪类组合 :first-child 和 :first-letter

我一直在研究 CSS 伪类,并尝试了一些可用的类来看看什么可以做,什么不能做。 我的问题是: 我想使用 :first-child se...


带有 :first-child 和 :first-letter 的令人困惑的伪元素语法

当我遇到一个奇怪的情况时,我正在摆弄 CSS 选择器。 如果我使用 :first-child 伪元素,我需要在它前面添加一个空格才能使其工作,如果我不这样做,它将不起作用。怎么...


绑定了formControlName后,如何在html中使用它?

我当前有问题的 html 部分是这样的 ... 我的 html 当前有问题的部分是这个 <div class="psi-list"> <div class="flex-row" *ngFor="let item of psiList; index as i"> <p class="row-psi">{{ item.psi }}</p> <button class="icon-btn" (click)="deletePsi(item.psi)"><i class="cil-trash"></i></button> <button class="icon-btn" (click)="item.toggle = !item.toggle"><i class="cil-pen-alt"></i></button> <form [formGroup]="psiEditForm" id="psi-edit-form" class="form-horizontal" [hidden]="!item.toggle"> <input class="psi-input" type="text" placeholder="Update PSI here..." [(ngModel)]="psiEdit" [ngClass]="{'is-valid': !checkControlValidation(psiEditForm.controls.psi) && psiEditForm.controls.psi.touched, 'is-invalid': checkControlValidation(psiEditForm.controls.psi)}" (keydown.enter)="!psiEditForm.controls.psi.invalid ? editPsi(item.psi) : clearPsiEdit()" formControlName="psi" /> <div class="help-block validation-warning" *ngIf="checkControlValidation(psiEditForm.controls.psi)"><i class="fa fa-exclamation fa-lg"></i>Please Enter a Valid 2 Letter PSI</div> </form> </div> </div> 我使用 formControlName“psi”将控件传递给 .ts 文件中的 checkControlValidation 方法。然而,这会导致功能问题。每当我在一个输入框中输入内容时,它都会将其输入到 *ngFor 中的所有输入框中。 当我将表单控件名称更改为这个时 - [formControlName]="item.psi" 它将名称绑定到与其相关的项目,因此理论上我可以通过它来解决我的问题。但是,当我将 psiEditForm.controls.psi 的所有实例更改为 psiEditForm.controls.item.psi 时,我收到很多 TS2339 错误。 我有什么想法可以使用它吗?抱歉,我知道这可能措辞很糟糕 尝试这样 <div class="psi-list"> <div class="flex-row" *ngFor="let item of psiList; index as i"> <p class="row-psi">{{ item.psi }}</p> <button class="icon-btn" (click)="deletePsi(item.psi)"><i class="cil-trash"></i></button> <button class="icon-btn" (click)="item.toggle = !item.toggle"><i class="cil-pen-alt"></i></button> <form [formGroup]="psiEditForm" id="psi-edit-form" class="form-horizontal" [hidden]="!item.toggle"> <input class="psi-input" type="text" placeholder="Update PSI here..." [(ngModel)]="psiEdit" [ngModelOptions]="{standalone: true}" [ngClass]="{'is-valid': !checkControlValidation(psiEditForm.controls.psi) && psiEditForm.controls.psi.touched, 'is-invalid': checkControlValidation(psiEditForm.controls.psi)}" (keydown.enter)="!psiEditForm.controls.psi.invalid ? editPsi(item.psi) : clearPsiEdit()" formControlName="psi" /> <div class="help-block validation-warning" *ngIf="checkControlValidation(psiEditForm.controls.psi)"> <i class="fa fa-exclamation fa-lg"></i>Please Enter a Valid 2 Letter PSI </div> </form> </div> </div>


React CSS 导入

在我的 Home.js 中我有以下代码 从“反应”导入反应; 导入'./Home.css'; 常量文本变体 = {...} 常量主页 = () => { 返回 ( ... 在我的 Home.js 中,我有以下代码 import React from 'react'; import './Home.css'; const textVariants = {...} const Home = () => { return ( <div id='home' className='page'> <motion.div className='text-wrapper' variants={textVariants} initial='initial' animate='animate'> <motion.div className='text-container' variants={textVariants}> <motion.h1 variants={textVariants}>NAME</motion.h1> <motion.h2 variants={textVariants}>An enthusiatic university student</motion.h2> </motion.div> </div> ); }; export default Home; 在 Home.css 中, .text-wrapper { max-width: 1366px; height: 100%; } .text-container { height: 100%; width: 50%; padding-left: 10%; h1 { letter-spacing: 10px; font-size: 50px; margin-bottom: -5%; } h2 { font-size: 80px; } } 我有 About.js 和 About.css 以及以下内容, import './About.css'; const About = () => { return ( <div id='about' className='page'> <div className='text-container'> <h1>About Me</h1> </div> </div> ); }; 但是 About.js 应用了 Home.css 中的内容,即 .text-container。我该如何避免这种情况?我不知道为什么 Home.css 被应用到 About.js 即使我没有导入它。 在React js中,任何根组件中导入的css文件适用于整个项目。 css 类可以在项目层次结构中的任何位置访问。 我们无法避免这种情况,因为文件被应用于根目录。您必须为不同的组件使用特定的类名称。 专业提示:创建可重用的组件,以便您可以将相同的类应用于每个相同的组件..


© www.soinside.com 2019 - 2024. All rights reserved.