CSS

Using XHTML with CSS to render Ajax response data adds layers of separation to our code, which allows us to update specific areas of the application without ever touching others. Now that we know how to render the data as XHTML by adding it to div elements with JavaScript, we can begin to add design to the page. We will do this by creating CSS classes that will define individual element styles and, ultimately, the entire page layout. The first step in using CSS in our HTML page is importing the CSS files that will define the styles for the page elements. Let’s first create a new file and name it layout.css. Building on the examples in Chapter 2, “The Request,” and Chapter 3, we will add the following code to the head of our index HTML file ...

Get Ajax for Web Application Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.