Skip to content

Commit b86f809

Browse files
committed
Updates
1 parent 71c1aa6 commit b86f809

File tree

1 file changed

+17
-15
lines changed
  • aspnetcore/blazor/tutorials/movie-database-app

1 file changed

+17
-15
lines changed

aspnetcore/blazor/tutorials/movie-database-app/part-8.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -199,25 +199,15 @@ Filtering database records is performed on the server, and the server interactiv
199199

200200
Instead of an HTML form, submitting a GET request in this scenario could've also used JavaScript to submit the request to the server, either using the [Fetch API](https://developer.mozilla.org/docs/Web/API/Fetch_API)` or [XMLHttpRequest API](https://developer.mozilla.org/docs/Web/API/XMLHttpRequest). In most cases, JavaScript can be replaced by using Blazor and C# in an interactive component.
201201

202-
## Style `QuickGrid` rows and cells
202+
## Style the `QuickGrid` component
203203

204-
You can apply table row and cell styles to the rendered `QuickGrid` component with a stylesheet isolated to the `Index` component using *CSS isolation*.
204+
You can apply styles to the rendered `QuickGrid` component with a stylesheet isolated to the `Index` component using *CSS isolation*.
205205

206-
CSS isolation only applies to the component you associate with the format `{COMPONENT NAME}.razor.css`, where the `{COMPONENT NAME}` placeholder is the component name. The filename is `Index.razor.css` to apply the isolated styles to the `Index` component.
206+
CSS isolation is applied by adding a stylesheet file using the file name format `{COMPONENT NAME}.razor.css`, where the `{COMPONENT NAME}` placeholder is the component name. The isolated stylesheet file name for the `Index` component is `Index.razor.css`.
207207

208-
To apply changes to a child component, such as the `QuickGrid` component of the `Index` component, use the `::deep` pseudo-element for element styles in the stylesheet. The `::deep` pseudo-element only works with descendant elements, so the `QuickGrid` component must be wrapped with a `<div>` in order to apply the styles to it.
208+
To apply changes to a child component, such as the `QuickGrid` component of the `Index` component, use the `::deep` pseudo-element.
209209

210-
In `Components/Pages/MoviePages/Index.razor`, place `<div>` tags around the `QuickGrid` component:
211-
212-
```diff
213-
+ <div>
214-
<QuickGrid ...>
215-
...
216-
</QuickGrid>
217-
+ </div>
218-
```
219-
220-
In the `MoviePages` folder, add a new isolated stylesheet for the `Index` component. Use `::deep` pseudo-elements to make the row height `3em` and vertically-center the table cell content.
210+
In the `MoviePages` folder, add a stylesheet for the `Index` component. Use `::deep` pseudo-elements to make the row height `3em` and vertically center the table cell content.
221211

222212
`Components/Pages/MoviePages/Index.razor.css`:
223213

@@ -231,6 +221,18 @@ In the `MoviePages` folder, add a new isolated stylesheet for the `Index` compon
231221
}
232222
```
233223

224+
The `::deep` pseudo-element only works with descendant elements, so the `QuickGrid` component must be wrapped with a `<div>` or some other block-level element in order to apply the styles to it.
225+
226+
In `Components/Pages/MoviePages/Index.razor`, place `<div>` tags around the `QuickGrid` component:
227+
228+
```diff
229+
+ <div>
230+
<QuickGrid ...>
231+
...
232+
</QuickGrid>
233+
+ </div>
234+
```
235+
234236
Blazor rewrites CSS selectors to match the markup rendered by the component. The rewritten CSS styles are bundled and produced as a static asset for you, so you don't need to take further action to apply the styles to the `QuickGrid` component when it's rendered.
235237

236238
![Movie list showing row heights at 3em with vertically-centered content](~/blazor/tutorials/movie-database-app/part-8/_static/styled-quickgrid.png)

0 commit comments

Comments
 (0)