You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/blazor/tutorials/movie-database-app/part-8.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,25 +199,15 @@ Filtering database records is performed on the server, and the server interactiv
199
199
200
200
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.
201
201
202
-
## Style `QuickGrid`rows and cells
202
+
## Style the `QuickGrid`component
203
203
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*.
205
205
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`.
207
207
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.
209
209
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.
221
211
222
212
`Components/Pages/MoviePages/Index.razor.css`:
223
213
@@ -231,6 +221,18 @@ In the `MoviePages` folder, add a new isolated stylesheet for the `Index` compon
231
221
}
232
222
```
233
223
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
+
234
236
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.
235
237
236
238

0 commit comments