Publishers of technology books, eBooks, and videos for creative people

Home > Articles

This chapter is from the book

Project 4.4 Creating Structured Layouts with Images

star.jpg ACA Objective 1.5

star.jpg ACA Objective 2.3

star.jpg ACA Objective 4.1

star.jpg ACA Objective 4.3

In the last two projects, you worked a bit with client-provided artwork to float images onto the page. Where there are single images like the ones you’ve used so far, inserting images and applying a float to move the graphic into position is relatively easy.

The About Our Staff page features blocks of text with the name and description of each character in the comic strip. In the olden days, layouts like this—in which an image is aligned and positioned next to a paragraph of text—would have been done using tables. Unfortunately, this approach renders such pages inaccessible to those using assistive devices (and to many search engine bots). Therefore, this practice has not been employed by practicing professionals in many years. In the modern world of web design, designers use more efficient methods that take advantage of advances in browser support for CSS. Through reliance on CSS for the style of the page, the HTML content remains accessible to those using assistive devices (and search engine bots) as well.

Dreamweaver accommodates the kinds of efficient, CSS-based designs that have become the industry standard and adds some visualization features that allow designers to get things just right.

The Design Challenge

The page that features all the characters from the comic strip should have an image of the character, with their name and “bio” alongside the image. The client helpfully provided all the character images at the same width and height, which will make the design work a bit easier.

The challenge for this layout is to maintain the association between the text and the image. You might consider inserting the image and using the CSS floats that were created in the last project to slide the image into place. The problem with this approach is that floated images don’t create a new “break” within the content on the page. You would have to insert a number of empty paragraphs by pressing Enter/Return over and over until each image appeared next to a line of text and had blank areas between each character. Of course, this approach would break as soon as the page is viewed on a mobile device with a different screen resolution.

Alternatively, you might consider inserting a table and placing the images into the left column and the text into the right column. Both of these approaches are semantically incorrect, difficult to maintain, and just a bad idea.

The better approach is to create a container that holds both the image and the text, and then use the power of CSS classes to define the container and all the content that applies to each character. The result of this project’s work will have the image of each character appear next to its information (Figure 4.28).

Figure 4.28

Figure 4.28 When this project is complete, each character will have its own content box in which to display its image and bio.

Preparing Content for the First Character Container

The client provided the name of each character and their bios in the Team Page area of prototype.html. With that file open, it’s time to begin.

  1. Place your cursor after the first character’s name (Ray) (after the colon), and press Enter/Return to insert a new paragraph. Clean up any extraneous characters (such as deleting the colon) or spaces until your text appears as follows:

    Ray

    Ray is the originator of…

  2. Place your cursor in front of Ray’s name, and use the Property inspector to assign the Heading 3 format to the character’s name.

  3. In the Assets panel, locate the ray-named.png file, and insert it into the page in front of the character’s Heading 3–formatted name.

Inserting a <div> for the Character Content

Now you need to create the container that will hold all the contents for each character: their image, their name, and their description.

  1. Drag to select the image and all the text associated with Ray (Figure 4.29).

    Figure 4.29

    Figure 4.29 The content on the page selected and prepared for styling

  2. Choose Insert > Div in the application bar. The Insert Div dialog appears.

  3. Leave the Insert field in this window set to Wrap Around Selection, and click the New CSS Rule button at the bottom of the dialog. The New CSS Rule dialog appears.

  4. With the Selector type at the top of the window set to Class, name the new rule .characters. Click OK. The CSS Rule Definition dialog appears.

  5. Select the Box category in the Category column, set the float property to left and the clear property to both (Figure 4.30), and click OK.

    Figure 4.30

    Figure 4.30 The CSS Rule Definition dialog for the new .characters rule

    You return to the Insert Div dialog.

  6. Click OK in the Insert Div dialog to complete the process of inserting the <div>.

The image and all the text are now contained inside their own container with the attribute class="characters". As you recall, when the <div> was inserted, the field was set to Wrap Around Selection. Dreamweaver displays this container with a dotted line around it when you are in Design view.

Floating an Image Inside a Container

Now it’s time to style the elements that are contained within this new <div>. Take note that these styling rules will use descendent selectors to create styling rules that will apply to any content found inside a <div> with the class name .characters applied.

  1. Select the image of Ray.

  2. In the CSS Designer panel, click the + in the Selectors section to create a new rule based on the item selected on the page.

    Dreamweaver will suggest that you name this rule .characters h3 img. Do you see how the cascade works? This rule will apply to any image that is inside an <h3> tag that is located in a <div> with the .characters class.

    But this is a little more specific than you need in this case.

  3. Delete the h3 descendent so that your rule name is .characters img. Don’t forget to press Enter/Return.

    This rule will now apply to any image found within the .characters <div>.

  4. In the Layout category in the Properties section, set the float property to left and the clear property to both (Figure 4.31).

    Figure 4.31

    Figure 4.31 Settings for the .characters img rule

    The text that’s associated with Ray jumps up beside the image, just like you want. Don’t be too concerned about the position of other characters on the page. Once all the containers are in place, things will sort themselves out. You can also check in code view to confirm that the image, header, and text are contained in the <div> tag.

Create a Second Character <div>

To see the interplay between two boxes that contain a character, let’s repeat the process you just followed for the Ronni character and insert a <div> around that area of the page.

  1. Edit the text so that Ronni’s name is on a new line, with her description below her name.

  2. Format the character’s name as an <h3>.

  3. Insert the image ronni-named.png to the left of her name.

  4. Select all the text and the image, then choose Insert > Div from the application bar or from the Insert panel.

  5. In the Insert Div dialog, select the existing CSS .characters class from the Class dropdown menu (Figure 4.32). Click OK.

    Figure 4.32

    Figure 4.32 You can assign an existing CSS class (characters) when you insert a new <div>.

    The contents of this new <div> snap into place. You now have two content boxes that you can use to adjust the styling.

Styling the Content Containers

Now that you have two character containers, you can fine-tune the styling properties for their contents. The beauty of using CSS rules is that once you adjust the settings for one container, all the other containers with the same class applied will be automatically updated.

  1. In the CSS Designer panel, select the .characters selector, and apply a border to the box. Make the border 1 pixel wide, with the style set to solid and the color set to black (#000000).

    You can select the Show Set check box to see only those properties assigned to the selector. Your settings should match those in Figure 4.33.

    Figure 4.33

    Figure 4.33 Border properties added to the .characters selector

    When you switch to Live view, you’ll see that the two containers have no space between their respective boxes. Text within the box is too close to the image, and the boxes are jammed up against the right side of the page. You’ll adjust these settings using the margin and padding properties.

  2. With the .characters rule still selected, deselect the Show Set box to see all the properties. In the Layout category of the CSS Designer panel, set the bottom margin of the container to 10 px. This adds space between the two boxes and separates them from each other.

  3. Apply a right margin of 15 px. This moves the right edge of the container away from the edge of the page.

  4. Apply a right padding of 10 px. This moves the text within the box away from the right border of the box.

    The final settings for the .characters rule should appear as in Figure 4.34.

    Figure 4.34

    Figure 4.34 Final settings for the .characters rule

    The final bit of tweaking needs to take place on the image: adding a bit of padding to the image to provide some “air” between the image and the text.

  5. Select the .characters img rule.

  6. In the Layout category, assign the padding values that you think look best for the right, bottom, and left padding properties. This is a great time to work in Live view so you can clearly see the changes that you make as they are applied.

Aligning Elements with Guides

One of the big advantages to using Dreamweaver to create and style web pages is the ability to put visualization tools into place that let you fine-tune your design. Guides are horizontal and vertical lines that Dreamweaver displays as you’re working. You can use these guides to check the alignment of elements on the page.

  1. With your document in Design view, choose View > Design View Options > Rulers > Show to display rulers on the top and left side of the document window.

  2. Choose View > Design View Options > Guides > Show Guides. With this option selected, you can click one of the rulers and drag a guide onto the page.

  3. Click the top ruler, and drag to position a guide directly above the first character’s name. If you’re having problems getting the guide into just the right place, deselect both View > Design View Options > Guides > Snap to Guides and View > Design View Options > Guides > Guides Snap to Elements.

    As you can see in Figure 4.35, the image isn’t perfectly aligned with the text. But you can fix that easily enough.

    Figure 4.35

    Figure 4.35 Rulers and guides allow you to check alignment of page elements.

  4. In the CSS Designer panel, select the .characters img rule, and adjust the top padding property to push the image down until it perfectly aligns with the character’s name. Top padding should now be 6 pixels.

  5. Drag a guide from the left ruler and position it in line with the right border of the character box.

    As you scan up the page, you’ll be able to see whether everything falls into alignment with this guide. Everything looks good in your character boxes, but the text in the paragraphs contained in the #content <div> are not in line with the borders of the character containers.

  6. Click anywhere in the first line of the introductory text on the page, then click the + in the Selectors section of the CSS Designer panel. Dreamweaver will suggest that this rule be named #container #content p.

  7. Press the Up Arrow key on your keyboard to make this rule a little less specific. The actual name you’re after here is #content p, which is specific enough for your purposes.

  8. Apply a right padding setting to this rule until the text in this paragraph and in others on the page is aligned with the guide. Right padding should now be 12 pixels for this rule.

  9. Save your page, and preview it in two of your favorite browsers. Look for alignment issues that need to be addressed and return to Dreamweaver to make adjustments to the styling rules you’ve just created. Since different browsers use different layout engines, it is important to examine your work in a minimum of two different browsers.

Completing the Character Page Listing

You’re almost finished with this project; you have just one more task to complete. Following the same steps you used to get the Ray and Ronni character containers constructed, you need to edit the text, apply a Heading 3 to the character’s name, and then insert the character’s image next to the name. You’ll then wrap the character’s contents into a new <div> and assign the .characters class. As you complete each container, the styling rules you’ve created will be applied to the contents, and before long all the employees of WULVS will have their own neatly aligned listing on the page.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.peachpit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020