A semiconductor structure includes a substrate; a first semiconductor fin extending upwardly from the substrate; an isolation structure over the substrate and on sidewalls of the first semiconductor fin; a first epitaxial feature over the first semiconductor fin; a dielectric fin partially embedded in the isolation structure and projecting upwardly above the isolation structure; and first and second spacer features over the isolation structure. The first spacer feature is laterally between the first epitaxial feature and the dielectric fin. The first epitaxial feature is laterally between the first and second spacer features. Methods of forming the same are also disclosed.