Make use of Cloud services. More effectively


Cloud computing icon

Image via Wikipedia

 

Cloud and cloud services are the latest buzz words, be it with major organizations, medium businesses, individual developers or ordinary home users. Everyone wants to share and store their documents, media and files on to the cloud. That is because it is simple, you can access it anywhere, gives you centralized storage, providesbackup and most cloud service companies claim that it is exceedingly secure. Many technology evangelists around the world foresee Cloud as the next big thing incomputer technology and predict that it will change the way we work, store, share and connect.

Listed below are few common tips on how an individual or home user can effectively use cloud service.

Backup your documents from Google Docs

Google Docs is the most extensively used online documents storage and sharing cloud service offered by Google. It offers to store, edit, save and share all major document formats commonly in use. Even after the assurance of online reliability from Google, it is safer to keep a backup on your offline storage. Not because Google data centres may crash tomorrow, but simply because your Internet connection may face issues one day and you may need a specific document urgently.

With Google Docs, you can download all your online documents into a zip file and save it offline. It allows a maximum download of only 2GB per zip file.

Open Google Docs and log in using your Google account. Select checkboxes of all or only required documents. Click Actions. Click Download. Choose the respective document formats or proceed with the default selection. Click Download. Wait for the processing to complete, post which it will prompt you to open or save the zipped file. Save it offline.

Backup your documents from Google Docs

Listen to music from Dropbox

Dropbox is fabulously good for storing and sharing any kind of files over the Internet. You can even store your music collection on Dropbox. These music files can also be played online via DropTunes service.

If you do not have any music files in your Dropbox, upload few from your hard drive. I uploaded a track by Enrique Iglesias.

Listen to music from Dropbox 1

Now, go to DropTunes and log in with your Dropbox credentials only. Navigate to the folder where your music files are stored. It will list all music files with a Playnext to each one. Click the respective Play button to play that track online.

Listen to music from Dropbox 2

Sync My Documents on your Windows to Dropbox

The My Documents directory on Windows acts as a primary document storage directory for most of us. Isn’t that the sole purpose Microsoft created it in the very first place? I think yes.

You can sync your My Documents directory to Dropbox. Therefore, anything you store, move or delete within My Documents will automatically synchronize with Dropbox. You should have the Dropbox client installed on your computer and a Dropbox directory already set.

Right click on My Documents and select Properties. Click on Location tab. Click the Move button and choose the already set Dropbox directory. Click Select Folder. Click Apply and then OK. Your My Documents directory is now synced with Dropbox.

Note: My Documents directory in Windows 7 may be found under the directory with your Windows Username (commonly placed on the desktop).

Sync My Documents on your Windows to Dropbox

How do you play around with Cloud services?

Advertisements

iWeb – Build A Quick, Easy & Beautiful Website [Mac only]


IWeb

Image via Wikipedia

 

Having recently discovered a way to get my own (unlimited) domain names and several good places where I could host them for free, I can’t help but falling into the mood of web building. And while I’m at it, I think this is the perfect time to try building one using Apple’s own iWeb 09.

This free Mac website building tool comes with iLife suite – free with every new Mac purchase. It promises its users quick and easy ways to build beautiful websites. To be able to achieve that, iWeb comes with various ‘plug and play’ ready-made templates for users to use and modify.

Experience is the best teacher. So there’s no better way to explore what iWeb can do than by using it to make use of our domain name and web host.

Settling on the Settings

The first thing that you’ll see when you first open iWeb is the choices of templates. Don’t worry too much at this stage. Just pick the one that you like, and you can change your mind later.

free mac website builder tools
Then we can continue with the settings. Click the “Site” item on the left pane, and you’ll see the “Site Publishing Setting” opened in the middle pane. This is the place to change the name of your site from “Site” into something more appealing.
free mac web tools

If you want to publish your site on your chosen hosting service, choose “FTP Server” from the “Publish to” options. (Note: This option is not available on the older version of iWeb). Then fill in all the fields with the required information; from the site name, to the FTP settings, to the website URL.

iWeb

For you Facebookers, there’s a bonus that you’ll love: the ability to update your Facebook profile when you publish your site. Tick the checkbox and provide the user information if you want to activate this option.

mac web design software

Shaping the Site

The web building process itself is as simple as adding pages (Command + N), editing the text, and replacing the pictures.

mac web design software

If you want to, you can edit every element of the page by clicking on that specific element and opening the “Page Inspector” from the “View –> Show Inspector” menu or by pressing “Command + Option + I

mac web design software

There are several types of pages that you can add, such as a blank page; ready to edit pages (Welcome Page, About Me page); blog page – where you can write and update your posts; and also the rich-media pages (Photo Album page, Movies page and Podcast page).

The pages will be placed in the left pane and you can re-arrange the order as you like. You can also add another website(s) (Command + Shift + N) to the project, each with its own pages and themes.

designing web pages in a mac

Enhancing with Elements

To enhance your site, you can add as many kinds of elements you want to each page. There are four tabs on the right pane:

    • Audios –> You can add music to your pages from Garageband and iTunes

designing web pages in a mac

    • Photos –> You can add pictures from iPhoto and Photobooth

designing web pages in a mac

    • Movies –> You can add movies from iMovie and iTunes

free mac web design programs

    • Widgets –> You can add several ready made widgets, including the one to include HTML code called HTML snippet widget

free mac web design programs

There are more advanced settings that you can do by going deeper into the Page Inspector, but the scope is too big to be discussed here. You can find many nice effects while you experiment with iWeb.

After the building process is done, you can do the final step by clicking the “Publish Site” button below. If you put the FTP settings right, everything should be uploaded to your server, and your site will be alive.

iWeb might not be the ultimate tool for those professional-level web designers. But for everyday folks who just want to build a beautiful site quickly and easily, this app is more than capable to fulfill their needs.

Have you tried iWeb? Got any tricks to optimize iWeb? Share using the comments below.

A Beginner’s Guide to Using Cubase


 

What is Cubase
Cubase is one of the leading digital audio workstation (DAW) software programs. It gives access to everything you’ll need to to compose, record and produce a piece of music in any genre or style. It’s one of the big professional programs found in professional studios across the globe and has been a major part of the music production industry since the mid-1980s. Many of the software’s features have led to the improvement of sound quality in modern recordings, and indeed many of the new genres and styles of music created since the mid-nineties have come about thanks to the power and ability of Cubase as a composition and production tool.

What does Cubase do?
If you have any synthesisers or sound modules with MIDI, then you can hook them up to a computer and, using Cubase, you can record the MIDI information, put it into time, play around with the arrangement, adjust the characteristic of the sound and route the audio input into Cubase, recording it as a digital audio file (WAV, MP3, etc). If your synthesizers and modules don’t have midi, then you can still record the audio, cut it, move it around, time stretch it, change the pitch, run it through software effects, load it into a software sampler and play new arrangements with it.

If you want to record a band, then get a decent multi-input sound card (audio interface) and as many mics as you can, plug into it and record the component parts in live. Then you can slice, put into time, use the gate to take out background bleed, add effects, copy and paste bits, do multiple takes and keep the best bits. Finally, EQ, compress, mix, bounce to two tracks and burn to CD are all included features.

If you have a school musical to record, then let the video camera just capture all the visual bits – as that’s what it does best (and pointing Cubase at the stage isn’t going to achieve much!). Then hook up your computer, as with a band, using a multi-input audio interface and as many mics as possible so that you can record several areas of the stage and any headset or lapel mics that you are using. Then, import the video, align the audio tracks, adjust the volumes and mix down.

Don’t have other equipment? Then just compose some music from scratch using the instruments, sounds, loops, samples and videos which come with Cubase 6, which cover every genre, then mix, master, bounce to mp3 and make it your ring tone. You will want a controller keyboard to trigger notes and a sound card to play the sound, but that’s all.

Cubase 6 does everything you need when it comes to composing and recording audio, and it does it to a professional level. However, for this reason, it can look and feel very complicated, but don’t despair – the new version comes with a lot of very helpful introduction videos and content that walks you through the first steps of recording and producing music. You can be up and running in just a few hours.

Cubase 6 Content – So, what’s in the box?
Well, it’s quite a big box, and it needs to be because over 26 years Steinberg has built a lot of features and written a very long manual. I would recommend using the video tutorials instead.

In theory, you can create unlimited midi, audio and instrument tracks –note that you are of course limited by the power of your computer and some of the instruments are quite demanding. Instrument tracks have a software instrument embedded into them, which is fairly new and keeps the automation together with the track which is very handy – but you can still load instruments separately and then route midi tracks to them. You can load 64 virtual (software) instruments simultaneously.

In terms of physical inputs and outputs, you can have 256. You can also create 256 group channels. These are used to route mixer channels into, enabling you to add a single insert into a group of tracks, so if you want to group your drums together and compress them as one, then this is the way to do it.

Cubase 6 Media
Cubase comes with a massive library of loops and samples. The way to access all the sounds, including those which use virtual instruments, is to go to the “media bay”. This is essentially a file browser which allows you to filter by various attributes until you have found the right sound. So you start with Category (e.g. Bass, Piano, Percussion), then Sub Category (Synth Bass, Electric Piano, Tuned percussion), then down through musical styles, acoustic character and key. Once you have the sound you want, you just double click or send it to the project window. The sounds are playable while browsing and if it’s a virtual instrument sound, you can play it on your MIDI keyboard.

Amazingly, the audio loops will play back in time with your project and in the correct key! This means you can find a drum loop you like and drop it into the project, and then go back to the media bay and search for guitar loops, auditioning them against your drums until you find the right one. It doesn’t just play in time either – if your track is on beat 3 of a bar 2, it will move to beat 3 of bar 2 in the loop and start playing it. This means you can instantly be working with six or seven layered instruments that you have never heard before and that sound great together. You are, within minutes, listening to your new piece of music.

Part 2

Last time we took a look at what you got straight out of the box, and the basic setups you’d need to use Cubase 6 in different scenarios. Now, we’ll get a little more in-depth and see exactly what’s at your disposal when you have the software fired up.

The Instruments
Steinberg are continually tinkering with the software instruments included within Cubase 6, most recently adding Halion Sonic SE to the existing arsenal of software instruments. This compliments the scoring side of Cubase by offering a selection of sampled orchestral models – useful for classical composition.

Specifically then, you get:

Halion Sonic SE – A workstation-style software instrument offering a full range of sounds from orchestral, synthesiser, acoustic and percussion banks. You can make a full track using this alone, and it’s been touted as a software version of the Yamaha Motif – thinking that way, you are immediately saving yourself over £1000 when it comes to sourcing instruments. The diversity of the sounds you get and the professional quality make this one of the best virtual instruments on the market. This is only a lite version admittedly, but it certainly gives you enough to cover the basics.

Groove Agent One – This is where you get your drums from if you’re planning on using only Cubase 6 to provide your compositional tools (as opposed to plug-ins). It looks like a stereotypical MPC drum machine, which is handy for giving novice users an idea of what a drum machine looks like and how they generally work.

You can drag and drop samples and loops into it, and I’m happy to report that it sounds brilliant – much better than any of my hardware drum machines.

Prologue – This is a subtractive synthesiser good for lead synths and stabs; resonant sounds are easily created too. Subtractive synthesis is one of the stalwarts of electronic sound generation – the analogue synths from Moog use this method – so it’s safe to say you’ll be able to craft that soundscapes you’re after without fuss.

Spector – The Spector’s main feature are its spectrum filters, which can be drawn in with your mouse. It gives a unique insight into how comb filters work to create very different and unique effects on the audio signal.

Mystic – This instrument combines physical modelling and comb filters to generate some very surreal soundscapes. It’s great for film scores or alternative music…or for just sitting around and playing with in the early hours.

Embracer – Polyphonic modelling synth whose sole purpose is to generate pads and accompaniments. Need a pad? Embrace this…

(It’s worth adding that the Prologue, Spector, Mystic and Embracer all have a complex envelope stage, LFO, velocity control and control matrix, which is ideal for learning how signals can be manipulated post synthesis)

Monologue – A straight up monophonic modelling synth for rich Moog-style bass and lead tones. This synth has a lot more to play around with in terms of your classic synth controls, and is a good place to start when figuring out and experimenting with oscillators and filters etc.

Loop Mash 2 –It’s a bit of an odd one, this. It’s a serious head-turner for those students and home users who are perhaps not too confident musically, and will have even novice users immersed within an instant.

It’s essentially a completely different sort of program – a loop player with a massive amount of dynamic control and manipulation. The concept is that you load up to eight different loops (it will time stretch them into tempo with your song), set the ‘master’ loop (which determines the major hit-points and rhythm of the subsequent “mash”), and by changing the sensitivity and the interaction level slider on each loop you determine how each track interacts with the master loop.

The outcome is a new loop, derived from the combination of the loops you have loaded, with volume and timing of each individual’s inclusion in the mix being determined by the volume of the audio in each one, the sensitivity you have assigned it and the position of the interaction level slider.

Brilliantly, you can use you MIDI keyboard to trigger the various new loops you have manufactured into a new piece of work, which can then be recorded as a standard midi part. There are also loads of beat mashing effects that can be triggered via the keyboard too, and while it takes a while to get your head around it, you’ll end up with some fantastic results.

The effects

One of the main joys of digital music production are software effects. Okay, so some will say you can never replicate the nuances of hardware, but Cubase gives you unlimited compressors for free, and that’s not to be sniffed at. Quite simply, the advantages of software effects is that they do the job and can be used them on as many tracks, simultaneously, as you like without bouncing your tracks down.

I generally do all my writing, engineering and mastering simultaneously and then bounce to two tracks and onto CD. So, even after I have my finished piece of music, if I want to change a segment, add a new bit in, or someone says “can I spit on it”, I can just go in and make those adjustments and in minutes I’ll be burning a new finished CD.

Cubase 6 has over 60 effects and processors to choose from, so you can cover every aspect of EQing (parametric and graphic), filtering, chorus and flange, delays, phasers, compression and dynamics, modulation, reverb, and distortion.

Important inclusions that you may not be so familiar with are:

“Pitch Correct” which uses all of Cubase’s new analysis and pitch shifting technology to correct vocals or monophonic instruments.

“Multiscope” which gives you a graphic representation of the frequencies that are currently playing. This is a good teaching aid when it comes to working with EQing and filtering, as it gives you a graphical representation of what you want to EQ or what you have EQ’d.

Plug-ins are added into slots on the mixer and can be either sends or inserts. Inserts can also be added pre-fader or post fader, too, so you can teach everything you need to know about the signal path and how your good ol’ hardware mixer works.

Midi Sequencing

Ultimately, Cubase was designed for midi sequencing, but these days sequencing has gone beyond midi (although you can still use midi CC data, of course) and Cubase handles a lot of old CC information quite differently. However, the old and universal midi techniques are still very much part of Cubase but thankfully without the old days of timing issues, dropped notes and blue screens of death. Cubase is rock solid.

New styles of automation and Note Expression, through VST3.5, have revolutionised midi sequencing, and there are important aspects here that are going to become essential tools for future music production and that are currently only available on Cubase 6. Most notably, (‘scuse the pun), Note Expression allows you to embed automation information within a “midi” note. I call it “midi” because I don’t think we can officially class these as “midi” notes anymore – Cubase 6 has finally broken beyond this 1980’s standard and in doing so, they have broken away from the competition.

Part 3

Notation and Score
Cubase has been able to convert MIDI sequences to score and vice-versa for a very long time, and is ideal for musicians in the film industry, who need to work with notation and play back films whilst composing – Cubase will import any standard digital movie file.

The notation aspect has been vastly improved in Cubase 6, surprisingly making it a worthy adversary to Sibelius, with expressions now possible. With the inclusion of Halion Sonic SE to provide an Orchestral soundset (although you should look into HALion Symphonic Orchestra if you want to seriously compose and produce orchestral pieces), it becomes quite the formidable package.

Cubase 6 is so advanced that you can now take an audio recording of a flute, for example, and convert it to midi, including any articulations within the midi information. You can then print this out for lessons or send the midi to a VST3.5 instrument and play it back.

Multi-track Recording
An integral part of producing music, especially bands, is to multi-track record. Big studios will have each musician in a separate room and record their parts on to separate tracks. Smaller studios will record each part and layer them up to produce the same desired result – to have each instrument recorded onto a separate track so that you can EQ, apply effects and processors to them individually and then mix them together. This is a major part of Cubase, and being able to automate the functions of the mixer and effects means that using the software to do this is so much easier.

Cubase 6 also has a new feature specifically targeted at drums that allows you to quantise (put into time) audio files without cutting the events and moving them around. You simply set a hit-point threshold and an accuracy level and it then puts the drums in perfect time (or according to any specified groove).

Another new feature allows you to record multiple takes and group them together on a single track using “lanes”. Then you can slice the takes simultaneously, calling up the takes you want to work on by simply clicking on them.

Automation
Automation has become so powerful that very little has to be done in real time or “on-the-fly”. These days you don’t record the synth as you perform a filter sweep, you just record the act of doing a filter sweep and then edit it to perfection. Similarly, you don’t record fading a track in, you record the act of fading it in. Cubase handles automation of any settings of any virtual instrument, plug-in or part of the mixer. Any producer will need to know the ins-and-outs of automation as it is so powerful, and is how they achieve such high quality recordings.

Pitch correction and “vari-audio”
Firstly, what is Vari-audio? Well it’s a process in Cubase 6 that allows you to analyse, correct and edit the pitch of a vocal or monophonic instrument part with virtually no artifacts. The first part of the process analyses the file and puts a layer over the top of the audio wave. This layer shows the actual pitch graph of the audio mapped against a keyboard, as well as drag-able chunks of audio. Using Vari-audio you can drag vocals about as though they were midi notes, to the pitch and timing you want. You can also reduce unwanted vibrato and, of course, just have Cubase correct the pitch in keeping with the scale you are using.

Project Tempo Track
A serious advancement means that in Cubase 6 you can have the project tempo match that of an imported or recorded track – and it doesn’t have to be static either. The selected track will need to have identifiable rhythmic content, of course, but if your piece of music changes tempo and has a drum part, you can have Cubase 6 analyse the drum part and adjust the project tempo accordingly. As you edit and add the other parts you’ll be able to quantise to the rhythm of the selected drum part. This also has an impact on the notation side of Cubase, as you are now able to chop and change tempo using the standard methods of notation, and all parts will snap into time (if requested).

In Summary
It’s hard to think of an aspect of music composition and production that isn’t encompassed in Cubase. It’s been around for 26 years in various forms and has been one of the two most popular DAW’s for most of that time. It will certainly remain one of the top music production programs for many years to come too, so you’ll be giving your students a sound education on a program they will find in most top studios.

There are elements within Cubase that allow teaching from a basic introduction to the very highest level of music production. The look and feel of the program grabs attention these days, too and the instrument and loop content plays a big part in bringing those who have no music training into the classroom, with relevant and current sounds which help you quickly, easily and intuitively compose an original piece of music.

Ultimately, you need look no further than Cubase 6 when writing electronic music, pop music or classical music and recording and mastering any form of music – it’s quite the package.

Adobe Dreamweaver CS5 – Part 6: Publishing your website


Adobe Dreamweaver CS4 logo

Image via Wikipedia

Welcome to the sixth and final part of this article series on creating your first website. This tutorial shows you how to set up a remote site in Dreamweaver. A remote site is usually a web server on a remote computer that holds copies of your local files. Users access the remote site when they view your pages in a browser.

This tutorial presents a very broad example of connecting to a remote server. It contains troubleshooting hints, but much depends on how your remote server is configured. When in doubt, consult your hosting company’s help desk or your system administrator.

Learn about remote sites

After you create a website, the next step is to publish it by uploading the files to a remote server. This is where you store your files for testing, production, collaboration, and publication (depending on your environment).

Before you can proceed, you must have access to a remote web server—such as a hosting company’s server, a server owned by the client you’re working for, or an intranet server within your company. Also, some Internet Service Providers (ISPs) provide access to free web space as part of your contract for internet connection. If you don’t have access to such a server, contact your ISP, your client, your system administrator, or one of the many hosting companies that provide web hosting packages. Some hosting packages are free, but usually insert advertisements into your site. An advertisement-free package can cost as little as a few dollars a month.

Alternatively, you can run a testing server on your local computer or network. For more information, see Setting up a local testing server in Dreamweaver CS5. The rest of this article concentrates on connecting to a remote server using FTP (file transfer protocol) or SFTP (secure file transfer protocol).

You also need to have a local site defined before you proceed. For more information, see Part 1 of this tutorial series,Setting up your site and project files.

Note: For more information about Dreamweaver sites, see Setting up a Dreamweaver site in Dreamweaver Help.

Define a remote server

Dreamweaver site management is based on the principle that your local files are an exact duplicate of your live site on the internet. So, index.html in your check_cs5 folder becomes the front page of your remote site. If you already have a live website that you don’t want to overwrite, use your site’s control panel to create a folder called check_cs5 where you can upload the Check Magazine files.

  1. In Dreamweaver, select Site > Manage Sites.
  2. In the Manage Sites dialog box, select the Check Magazine site.If you did not define the Check Magazine site, create a local folder for the site before you proceed. For more information, see Part 1 of this tutorial series, Setting up your site and project files.
  3. Click Edit.
  4. In the Site Setup dialog box, click Servers to open the panel where you add your server definitions (see Figure 1).

The Servers panel in the Site Setup dialog box.

Figure 1. The Servers panel in the Site Setup dialog box.

Dreamweaver CS5 allows you to set up multiple server definitions for both remote and testing servers. However, only one of each type can be active at any given time.

  1. Click the plus button at the bottom left of the panel to add the remote server definition. This opens a new panel for you to enter the server details (see Figure 2).

The panel where you enter the basic server details.

Figure 2. The panel where you enter the basic server details.

  1. In the Server Name text box, type a name for the server. This is used internally by Dreamweaver to identify the server, so you can choose any name you like. For example, you might want to create a definition for a server where you upload files for a client’s approval, and a different server for the live site. If you have only the one server, call it Remote Server.
  1. From the pop-up menu Connect using, select the method you want to use to connect to the server.The most common methods for connecting to a server on the Internet are FTP and SFTP. If you aren’t sure which to select, ask your hosting company or the server system administrator.
  2. The following options apply to both FTP and SFTP:
    • Enter the server’s FTP address (for example, ftp.yourdomain.com).
    • Enter your user name and password in the appropriate text boxes.
    • Click Test to test your connection.

    If the connection is unsuccessful, verify that you have the correct username and password. Passwords are usually case-sensitive, so make sure that Caps Lock is not turned on. If you selected SFTP, try FTP instead. If that doesn’t solve the problem, consult the troubleshooting section further down this page.

  3. The value that you need to enter in Root Directory is where many people go wrong, and it’s difficult to give precise instructions because hosting companies and server administrators have different policies.As I said earlier, Dreamweaver site management is based on the principle that your local files are an exact duplicate of your live site on the Internet. The value of Root Directory should be the path you need to enter after logging into your server to get to the folder where you want to install index.html.
    • If you want the Check Magazine home page to be the front page of your website, then this needs to be the path to the remote server’s site root. On some servers, it’s public_html. Others might use wwwwwwroot, or even nothing at all. On my remote server, it needs to be /home/username/public_html. If in doubt, ask your hosting company or server administrator.
    • If you want the Check Magazine home page to be in a subfolder called check_cs5, you need to enter the path to that folder. For example, on my server, it would be /home/username/public_html/check_cs5.
  4. The Web URL text box should contain the URL for the folder that you defined as the Root Directory. For example,http://www.example.com/ or http://www.example.com/check_cs5/. Dreamweaver might have tried to guess the correct value, but it’s only a guess. Do not accept the default value without checking it carefully.

Your settings should look similar to Figure 3.

Settings for connecting to a remote server by SFTP.

Figure 3. Settings for connecting to a remote server by SFTP.

  1. Click the Advanced button at the top of the panel to display the advanced options (see Figure 4).

Advanced options for a remote server.

Figure 4. Advanced options for a remote server.

  1. In most circumstances, you should leave these options at their default settings.
    • Maintain synchronization information is selected by default. This keeps track of when the files on your remote server were last updated, and allows you to use the Site Synchronization feature (see Synchronize the files on your local and remote sites in Dreamweaver Help).
    • Automatically upload files to the server on Save should rarely, if ever, be used because it overwrites your live files. If you make a mistake, it’s immediately displayed on your remote site for all the world to see.
    • Enable file check-out is for use in a team environment. It allows only one person at a time to edit a page (seeChecking in and checking out files in Dreamweaver Help).
  2. Click Save to register your server definition. This returns you to the Servers panel of the Site Setup dialog box, where your server definition is now listed (see Figure 5).

The remote server is now registered in the Site Setup dialog box.

Figure 5. The remote server is now registered in the Site Setup dialog box.

Dreamweaver selects the Remote checkbox automatically.

The icons at the bottom of the Servers panel allow you to add another server, or to delete, edit, or make a copy of the selected server definition. Making a copy is useful if you need to change only a few details to connect to a different server.

  1. Click Save to close the Site Setup dialog box, and then click Done to close the Manage Sites dialog box.

Upload your local files

You can now upload your files from your local folder to the remote web server to make your pages publicly accessible.

  1. In the Files panel (Window > Files), select the site’s local root folder (check_cs5).Note: In the Files panel, the local root folder actually begins with “Site – Check Magazine” because that’s the name of the site. If you hover the cursor over that title, Dreamweaver shows you the full path to the check_cs5 folder.
  2. Click the Put Files (up arrow) icon in the Files panel toolbar (see Figure 6).

Put files on the server.

Figure 6. Put files on the server.

  1. When Dreamweaver asks if you want to put the entire site, click OK.Dreamweaver copies all of the files to the remote folder you defined in the previous section. This operation may take some time, as Dreamweaver must connect to the remote server and then upload all the files.

    Note: Normally, you select the local root folder and upload the entire site only the first time you upload. Afterwards, you can upload only the files you’ve changed.

  2. Open your remote site in a browser to make sure all of the files uploaded correctly. Congratulations, you have a site online!

(Optional) Troubleshoot the remote server setup

A web server can be configured in many ways. The following list provides information about some common issues you may encounter in setting up a remote server and how to resolve them:

  • The Dreamweaver FTP implementation may not work properly with certain proxy servers, multilevel firewalls, and other forms of indirect server access.
  • In the panel where you set the basic options for the remote server, set the “Connect using” pop-up menu to FTP, and click the triangle at the bottom of the panel to reveal the More Options section (see Figure 7).

The More Options section can help solve FTP connection problems.

Figure 7. The More Options section can help solve FTP connection problems.

  • Use Passive FTP often solves connection problems caused by a software firewall.
  • Use IPV6 Transfer Mode should be used only if your remote server supports the newer IPv6 protocol (check with your hosting company or server administrator).
  • If you need to connect through a proxy server, select the Use Proxy check box, and click the Preferences link to set up the proxy details.
  • The other two options are self-explanatory.
  • If you still have problems with FTP access, contact your hosting company or system administrator for help.
  • For the Dreamweaver FTP implementation, you must connect to the remote system’s root folder. (In many applications, you can connect to any remote directory, and then navigate through the remote file system to find the directory you want.) Be sure that you indicate the remote system’s root folder (or the check_cs5 subfolder) as the Root Directory. If you have problems connecting, and you’ve specified the host directory using a single slash (/), you might need to specify a relative path from the directory you are connecting to and the remote root folder. For example, if the remote root folder is a higher-level directory, you may need to use ../../ to specify the host directory.
  • File and folder names that contain spaces and special characters often cause problems when transferred to a remote site. Use underscores in place of spaces, and avoid special characters—colons (:), slashes (/), periods (.), and apostrophes (‘) are not permitted in file or folder names.
  • Many servers use symbolic links (Unix), shortcuts (Windows), or aliases (Macintosh) to connect a folder on one part of the server’s disk with another folder elsewhere. For example, the public_html subdirectory of your home directory on the server may really be a link to another part of the server entirely. In most cases, such aliases have no effect on your ability to connect to the appropriate folder or directory; however, if you can connect to one part of the server but not to another, there may be an alias discrepancy.
  • If you encounter an error message such as “cannot put file,” your remote folder may be out of space. For more information, look at the FTP log.

Note: In general, when you encounter a problem with an FTP transfer, examine the FTP log by selecting Site > Advanced > FTP Log. For more information, see the extensive tech note on FTP troubleshooting on the Adobe website.

Adobe Dreamweaver CS5 – Part 5: Adding the Spry menu


Adobe Dreamweaver CS4 logo

Image via Wikipedia

Welcome to Part 5 of this tutorial series on creating your first website. This tutorial shows you how to add a Spry Menu Bar widget to the index page for Check Magazine, a fictional publication. A Spry Menu Bar widget is a set of navigational menu buttons that link to other pages of your website. In many cases, the menu displays submenus when a site visitor hovers over one of the buttons (though you won’t be using submenus in this tutorial). You may have heard of a navigation bar for a website—that’s essentially what I’m talking about here. Adobe calls its navigation bar a Spry Menu Bar widget, because the widget is a built-in part of the Adobe Spry framework for Ajax and comes installed with Dreamweaver CS3 and later.

The tutorial also shows you how to customize the widget by editing its CSS rules.

Note: For more information about the Spry Menu Bar widget in general, see Working with the Menu Bar widget in Dreamweaver Help. For more information about the Spry framework for Ajax, see About the Spry framework in Dreamweaver Help.

Locate your files and review your task

In this tutorial, you’ll begin with the index page you added text to in Part 4, Adding the main image text. If you did not complete that tutorial, you must complete it before proceeding, or download first_website_pt4_completed.zip and begin with those files. If you haven’t completed Part 1: Setting up your site and project files, you will need to complete that tutorial as well.

Your task in this tutorial is to add a Spry Menu Bar widget to the banner area of the Check Magazine home page. You’ll also learn how to customize the menu bar by editing its CSS rules. Figure 1 shows what the banner area will look like in a browser after you’ve added the menu bar.

The banner area of the Check Magazine home page with a Spry Menu Bar widget included.

Figure 1. The banner area of the Check Magazine home page with a Spry Menu Bar widget included.

Basically what you’ll do to accomplish this task is very similar to what you did in Part 4, Adding the main image text, of this tutorial series. You’ll add another content element to an already specified div (in this case, the new content element is a Spry Menu Bar widget, and the already specified div is the banner div), and use a combination of relative and absolute positioning to move the new element into place.

Insert and position the Spry Menu Bar widget

Dreamweaver lets you insert two kinds of Menu Bar widgets: vertical and horizontal. In this tutorial, you’ll insert a horizontal Menu Bar widget, as pictured in the previous section.

  1. In Dreamweaver, open the index.html file that you created in Part 4: Adding the main image text.
  2. Click in the banner div to select the banner image. Then press your right arrow key once to place the Insertion point to the right of the image, but still inside the div. You should see a large blinking Insertion point in the banner div (the top div.
  3. Click the Split view button to make sure the Insertion point is in the banner div between the <img> tag and the closing </div> tag. (This is very important; see Figure 2).

The Insertion point inside the banner div.

Figure 2. The Insertion point inside the banner div.

  1. Select Insert > Spry > Spry Menu Bar.Tip: You can also insert a Spry Menu Bar widget from the Spry category of the Insert panel. The Spry category of the Insert panel shows you all of the Spry widgets available in Dreamweaver.
  2. In the Spry Menu Bar dialog box, leave Horizontal selected and click OK.The Menu Bar widget, with its default color scheme of black text and gray background, is inserted in the page, but pushes the main image to the right (see Figure 3).

The Spry Menu Bar widget drops below the banner image, and displaces the main image.

Figure 3. The Spry Menu Bar widget drops below the banner image, and displaces the main image.

  1. You’ll fix the layout in a moment, but take a look at the code for the Menu Bar widget in Code view. The Menu Bar widget is actually a set of unordered lists nested inside a container <ul> (unordered list) tag. Each menu item is in<li> (list item) tags, and everything is styled with CSS. The container <ul> tag is assigned the CSS class attributeMenuBarHorizontal , the main attribute referenced in the many CSS rules responsible for the widget’s formatting.Note: I have not talked about CSS class rules in this series, and I’m not going to go into an in-depth explanation of them here; but essentially a class rule is a type of CSS rule that lets you format any HTML element on the page. Class rules do not restrict you to formatting specific tags or elements with IDs. For more information on class rules, see Understanding Class Rules in Dreamweaver
  2. The first thing you should do after inserting a Spry widget is to save the page.The Copy Dependent Files dialog box appears, stating that Dreamweaver is copying a number of supporting files to your local site. These files are all related to the display and functionality of the Spry Menu Bar widget. In particular, the SpryMenuBar.js file contains all of the information that drives the widget’s functionality, whereas the SpryMenuBarHorizontal.css file contains all of the CSS rules that dictate the widget’s formatting.
  3. Click OK to close the Copy Dependent Files dialog box and install the dependent files.Dreamweaver adds a SpryAssets folder to the root folder of your site. (You might need to click the Refresh button in the Files panel to see the new SpryAssets folder.) This folder contains all of the files necessary for the Spry Menu Bar widget to function. Later, you’ll need to make sure you upload these files to the web server when you publish your page on the Web.You’ll also notice that the Related Files toolbar now lists the Spry files associated with the index page. That’s because when you saved the page after creating the widget, Dreamweaver automatically attached the required files to the page for you.
  4. Now, let’s fix the layout.To position the Spry Menu Bar correctly, you need to create a rule for the banner div. It’s generally a good idea to keep your style sheet in logical order, so the new rule should come after the body rule. Dreamweaver always inserts a new CSS rule immediately after the rule that’s currently selected in the CSS Styles panel.Open the CSS Styles panel, and make sure it’s in All mode. Select the #container rule, and click the New CSS Rule button (see Figure 4).

Select the #container rule and click the New CSS Rule button.

Figure 4. Select the #container rule and click the New CSS Rule button.

  1. Use the following settings in the New CSS Rule dialog box:
    • Set the Selector Type pop-up menu to ID.
    • Type #banner in the Selector Name text box.
    • Make sure the Rule Definition pop-up menu is set to check_cs5.css.
  2. Click OK to open the CSS Rule Definition dialog box, and select Positioning from the Category list on the left.
  3. Select relative from the Position pop-up menu, and click OK to close the dialog box.
  4. The main image snaps back into position, with the menu bar occupying a block of its own between the banner and main images (see Figure 5).

The menu now occupies a block of its own between the two images.

Figure 5. The menu now occupies a block of its own between the two images.

  1. Move your cursor pointer over the menu bar. This triggers the display of a turquoise tab at the top left. Click this tab to select the menu bar (see Figure 6).

Click the turquoise tab to select the menu bar.

Figure 6. Click the turquoise tab to select the menu bar.

  1. In the Property inspector, change the menu’s ID (in the text box just below Menu Bar) from the default MenuBar1to check_menu, and press Tab to make the change. The new ID is displayed in the Property inspector and in the Tag selector at the bottom of the Document window (see Figure 7).

Change the menu bar's ID in the Property inspector.

Figure 7. Change the menu bar’s ID in the Property inspector.

  1. You can now create a new CSS rule to position the menu bar.With the menu bar still selected in Design view, open the CSS Styles panel, select #banner , and click the New CSS Rule button.
  2. In the New CSS Rule dialog box, the Selector Name text box should be automatically populated with#container #banner #check_menu .Click the Less Specific button twice to leave just #check_menu .Make sure that Rule Definition is set to check_cs5.css, and click OK.Note: If the correct values weren’t automatically selected in the New CSS Rule dialog box, just set them manually. When setting the values manually, select ID from the Selector Type pop-up menu.
  3. In the CSS Rule Definition dialog box, select Positioning from the Category list on the left.
  4. In the Positioning category, use the following settings:
    • Position: absolute
    • Top: 50 px
    • Right: 0 px
    • Bottom: 0px

    Click OK to close the dialog box.

  5. Check the position of the menu bar in Design view. It’s not quite right. It’s aligned with the right edge of the banner image, but isn’t aligned correctly at the bottom (see Figure 8).

The menu bar isn't in the right position in Design view.

Figure 8. The menu bar isn’t in the right position in Design view.

The reason for this is because there are conflicting top and bottom offsets for the #check_menu style rule. The ultimate aim is to align the bottom and right of the menu bar with the bottom and right edges of the banner image, in the same way as you aligned the main_text div against the guides in part 4 of this tutorial series.

Unfortunately, the menu’s own style rules prevent Design view from displaying the menu in the correct position. So, the top offset of 50 pixels has been added as a temporary measure to make life easier while working in Design view.

  1. Select #check_menu in the CSS Styles panel, and move your cursor pointer to the left of the top property in the Properties pane until the Disable CSS Property icon appears (see Figure 9).

Temporarily disable the top property for #check_menu.

Figure 9. Temporarily disable the top property for #check_menu.

Click once to disable the top property temporarily. If you’re lucky, the menu should snap into its correct position, but it’s more likely to jump to the top of the banner div and remain inaccessible in Design view.

Note: If you’re using an older version of Dreamweaver, you’ll need to comment out the top property manually in the style sheet.

  1. Click the Live View button. The menu is displayed where you want it—aligned with the right and bottom edges of the banner image (see Figure 10).

The menu bar is in the right position in Live View.

Figure 10. The menu bar is in the right position in Live View.

  1. Click the Live View button to exit Live View, and re-enable the top property by clicking the disabled symbol to the left of its name in the CSS Styles panel.
  2. Select File > Save All Related Files to save all your changes.

Change the width of the Menu Bar widget

The appearance of the Spry Menu Bar widget is controlled by the CSS in the SpryMenuBarHorizontal.css file that Dreamweaver just added to your site. The SpryMenuBarHorizontal.css file resides in the SpryAssets folder (see Figure 11).

The SpryMenuBarHorizontal.css file in the SpryAssets folder of your site.

Figure 11. The SpryMenuBarHorizontal.css file in the SpryAssets folder of your site.

You can (and now do) have multiple CSS files attached to a single page. For example, if you add more Spry widgets to the page, Dreamweaver creates and attaches a new style sheet for each of the new widgets you add.

  1. Double-click SpryMenuBarHorizontal.css in the Files panel to open it in the Document window. You’ll see that the CSS rules that format the Menu Bar widget are long and—if you’re not familiar with CSS—confusing. Unfortunately, of all the Spry widgets that come with Dreamweaver, the Menu Bar widget is the most complicated animal, and in order to avoid confusing you any more than you need to be, I’m going to avoid talking in depth about these rules.Note: There’s an in-depth tutorial about customizing a Spry menu bar on my website athttp://foundationphp.com/tutorials/sprymenu/customize1.php.Luckily, Dreamweaver makes it somewhat easier to customize the Menu Bar widget by giving you the ability to edit the widget’s CSS rules in the CSS Styles panel.
  2. Any changes made to SpryMenuBarHorizontal.css automatically affect every Spry menu bar in the same site. So, before editing the style sheet, it’s a good idea to make a copy, and make the changes to the copy. That way, if you make a mess of the menu, you can always revert to the original file.With SpryMenuBarHorizontal.css the active document, select File > Save As. In the Save As dialog box, navigate to the styles folder in the Check Magazine site, and save the file as check_menu.css. When Dreamweaver asks if you want to update the links, click Yes.
  3. Close both SpryMenuBarHorizontal.css and check_menu.css.
  4. You need to detach SpryMenuBarHorizontal.css from index.html and attach check_menu.css in its place.In the CSS Styles panel, select SpryMenuBarHorizontal.css, and click the trash can button at the bottom of the panel to unlink the style sheet (see Figure 12).

Unlink SpryMenuBarHorizontal.css.

Figure 12. Unlink SpryMenuBarHorizontal.css.

  1. Click the button that looks like a chain link at the bottom of the CSS Styles panel to attach a new style sheet (see Figure 13).

Attach a new style sheet.

Figure 13. Attach a new style sheet.

  1. In the Attach External Style Sheet dialog box, click the Browse button to navigate to check_menu.css in the stylesfolder, and click OK (Windows) or Choose (Mac OS X) to select it. Then click OK to close the Attach External Style Sheet dialog box.You should now have two style sheets listed in the CSS Styles panel: check_cs5.css and check_menu.css (see Figure 14).

The copy of the menu's style sheet has been attached to the page.

Figure 14. The copy of the menu’s style sheet has been attached to the page.

  1. Save index.html. The two style sheets should be listed in the Related Files toolbar, together with SpryMenuBar.js, the external JavaScript file that controls the menu (see Figure 15).

The two style sheets and the JavaScript file are listed in the Related Files toolbar.

Figure 15. The two style sheets and the JavaScript file are listed in the Related Files toolbar.

  1. Click the Current button in the CSS Styles panel. (You’ve been working in All mode up until now.)
  2. In the Document window, select the Menu Bar widget by clicking its turquoise tab. (Hover over any part of the widget to make the tab appear.)Tip: You can always tell which page element is selected by looking at the Property inspector (Window > Properties). In this case, you’ll be able to tell if the Spry Menu Bar widget is selected if you see its properties displayed in the Property inspector.You’ll notice a few things happening in the CSS Styles panel after you’ve selected the widget. One is that the#check_menu rule appears in the Properties pane of the CSS panel. That’s because the #check_menu rule governs the <ul> container for the widget (the tag you’ve selected). The other thing you’ll notice is the appearance of properties for the #check_menu rule in the Properties pane. Even with a large monitor, you’ll probably need to resize the CSS Styles panel to see everything I’m talking about. You can resize the panel by dragging the bottom boundary of it downwards. This will reduce the height of the Files panel, but that’s OK. Alternatively, double-click the Files panel tab to close it. For now, you need as much real estate in the CSS Styles panel as possible (see Figure 16).

The CSS Styles panel in Current mode.

Figure 16. The CSS Styles panel in Current mode.

Tip: You can also resize any of the three separate panes in the CSS Styles panel by dragging their top or bottom borders.

OK, now that you can see everything you need to see in the CSS Styles panel, you can begin editing the widget. But before you proceed, ensure that the Rules pane in the CSS Styles panel looks like Figure 16. THIS IS VERY IMPORTANT. If it doesn’t, chances are you have About view showing in the Rules pane, rather than the cascade of rules. If you have About view showing in the Rules pane, click the Cascade button in the upper right corner of the Rules pane. (There are only two buttons there; it’s the one on the right.)

  1. Click the ul.MenuBarHorizontal rule in the Rules pane to select it. When the ul.MenuBarHorizontal rule is selected, the full name of the rule appears below in the title bar of the Properties pane.
  2. Click the Add Property link in the Properties pane. This opens a pop-up menu.
  3. Click the pop-up menu arrow to reveal the menu, scroll down to find the text-transform property, and select it.
  4. From the value pop-up menu to the right, select uppercase.The text in your Menu Bar widget changes to uppercase.
  5. Now click inside the text ITEM 2 in the Menu Bar widget. (Do not select the text, simply click somewhere inside of it.)Three more rules appear in the Rules pane of the CSS Styles panel, with the last rule selected. There are now a total of eight rules listed, five of them related to the Menu Bar. (You might need to expand the Rules pane to see them all.)
  6. In the Rules pane, click the third Menu Bar rule in the list, the ul.MenuBarHorizontal li rule.
  7. In the Properties pane, edit the last property listed ( width ). Click the 8 em value of the width property to make it editable, and then change the width to 7 em (see Figure 17), and then press Enter/Return.

Change the width property for the ul.MenuBarHorizontal li rule.

Figure 17. Change the width property for the ul.MenuBarHorizontal li rule.

The width of the menu items in the menu bar is reduced to 7 em. Don’t worry that the menu is no longer aligned with the right edge of the banner image. You’ll fix that in a moment.

Note: When you see strikethrough lines in the CSS Styles panel (for example, the width property is struck through in Figure 17) it means the property doesn’t directly affect what’s currently selected in Design or Code view. Your cursor is inside the text, but the width property here governs the surrounding <li> tags, not the text itself. Of course, changing the width property of the <li> element has an indirect effect on the text inside.

If you want to see what I mean, hover over the edge of the ITEM 2 menu item in Design view until you see its border outlined in red, then click to select the item. When you select the item, all strikethroughs in the CSS panel should disappear. That’s because all of the rules you’re now viewing directly affect that selection (the <li> tag). And if you’re still not convinced, just look down at the Tag Selector at the bottom of the Document window. The <li> tag should be selected down there as well.

If you do all of this, be sure to click back inside the ITEM 2 text when you’re finished. You need to have the <li> tag deselected for the rest of the following tasks.

  1. In the Rules pane, click the fourth Menu Bar rule in the list, the ul.MenuBarHorizontal a rule.
  2. In the Properties pane, select the padding property and click the Delete CSS Property button, the trash can icon (see Figure 18).

Delete the padding property from the ul.MenuBarHorizontal a rule.

Figure 18. Delete the padding property from the ul.MenuBarHorizontal a rule.

After you delete this rule, the Menu Bar should be much shorter in Design view. It also springs back in alignment with the right edge of the banner image.

Edit the Menu Bar widget’s text and links

Now that you’ve reduced the default size of the menu bar, you’ll edit the menu bar items themselves. But before you do that, I want to show you how the default submenus of the Menu Bar widget work.

  1. Click the Live View button to enter Live View.
  2. Run the cursor over the menu bar and observe the interaction. Items 1 and 3 have submenus. If you hover over Item 3, you’ll see that the Item 3.1 submenu has a submenu (see Figure 19).

The Menu Bar widget and its submenus.

Figure 19. The Menu Bar widget and its submenus.

Menu Bar widgets can have as many submenus as you want. However, the Dreamweaver Property inspector only supports two levels of submenus. To add more submenus, you need to work directly in the code.

You don’t need to worry about submenus right now though. You’re actually going to get rid of all of them for this website.

  1. Click the Live View button again to exit Live View.
  2. Select the Menu Bar widget in the Document window by clicking its turquoise tab.
  3. In the Property inspector, make sure Item 1 is selected in the first column.
  4. Select the submenu item, Item 1.1, in the second column, and click the minus (Remove menu item) button (see Figure 20).

Delete the first submenu item from Item 1.

Figure 20. Delete the first submenu item from Item 1.

  1. Delete Item 1.2 and Item 1.3 as well.
  2. Select Item 3 in the first column.
  3. Select the submenu item, Item 3.1, in the second column, and click the minus (Remove menu item) button.When you try to delete this submenu, Dreamweaver alerts you that you are also deleting the submenu’s submenu (referred to as its children). Click OK.
  4. Delete Item 3.2 and Item 3.3 as well.Now that you’ve deleted all of the submenus, you are ready to edit the menu bar text.
  5. Select Item 1 in the first column again and then do the following:
    • In the Text text box, type Features.
    • In the Link text box, type news.html (see Figure 21).

Text and Link values added for Item 1 of the Menu Bar widget.

Figure 21. Text and Link values added for Item 1 of the Menu Bar widget.

Note that the Menu Bar widget is changing before your very eyes. You don’t need to type capital letters in the Property inspector because you already defined a CSS rule that makes all letters in the Menu Bar widget capital no matter what.

Additionally, as in an earlier tutorial, you’re going to use the news.html page as your sample page for all links. But if you were building the website for real, you would be linking to separate pages.

  1. Select Item 2 in the first column of the Property inspector and then do the following:
    • In the Text text box, type Fashion.
    • In the Link text box, type news.html.
  2. Select Item 3 in the first column of the Property inspector and then do the following:
    • In the Text text box, type Lifestyle.
    • In the Link text box, type news.html.
  3. Select Item 4 in the first column of the Property inspector and then do the following:
    • In the Text text box, type Calendar.
    • In the Link text box, type news.html.

    Your Menu Bar widget now looks like Figure 22.

The Menu Bar widget after the text for all menu items has been changed.

Figure 22. The Menu Bar widget after the text for all menu items has been changed.

You’re almost there. You just need to add one more menu item to the widget.

  1. With the Menu Bar widget still selected, click the plus button above the first column in the Property inspector (see Figure 23).

Add another menu item.

Figure 23. Add another menu item.

Dreamweaver adds an Untitled Item to the menu bar.

  1. With the Untitled Item selected in the first column of the Property inspector, do the following:
    • In the Text text box, type News.
    • In the Link text box, type news.html.
  2. Click anywhere on the page to deselect the menu bar. Don’t worry if the new item in the menu bar has dropped down below the other items.
  3. Select File > Save All Related Files.
  4. Click the Live View button to turn on Live View. Then click it again to exit Live View. The menu items should all line up in a single row.

Change the Menu Bar widget’s colors

Only a few more edits and the menu bar will be final.

  1. Click anywhere inside the Menu Bar widget. For example, click inside the word Fashion.The five Menu Bar–related rules appear in the Rules pane of the CSS Styles panel.
  2. Click the fourth Menu Bar–related rule, the ul.MenuBarHorizontal a rule.
  3. In the Properties pane, click the black box in the color value field and use the eyedropper to select white ( #FFF), as shown in Figure 24.

Change the default text color.

Figure 24. Change the default text color.

You’ll notice that the text of the Menu Bar widget has changed to white. The ul.MenuBarHorizontal a rule is the rule that controls the text color of the menu items in their default state (that is, when you’re not hovering over them).

  1. Click the gray box in the background-color value field and use the eyedropper to select black ( #000 ).The background color of the menu items changes to black.
  2. Click the Live View button and run your cursor over the menu items.Yikes! You’re getting blue backgrounds upon hovering. That’s another default property of the Spry Menu Bar widget, so let’s change it.
  3. Click the Live View button again to exit Live View.
  4. Click anywhere inside the Menu Bar widget. For example, click inside the word Fashion.
  5. The five Menu Bar–related rules appear in the Rules pane again.Click the last Menu Bar–related rule, the ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus rule.Note: I know that it’s impossible to see the full name of this rule in the Properties pane. You just have to trust me that it’s the final rule listed in the Rules pane.
  6. In the Properties pane, click the blue box in the background-color value field and use the eyedropper to select black ( #000 ).
  7. Click the #FFF default color in the color value field, change it to #00ADEF (that’s zero, zero, A, …) and press Enter/Return (see Figure 25).

Change the background and text properties for the ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus rule.

Figure 25. Change the background and text properties for the ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus rule.

The #00ADEF color is blue, as you can see. It’s the color the menu bar’s text will change to when you hover over the links in the menu bar.

Note: Don’t forget the hash sign at the beginning of the hexadecimal number for the color.

  1. There’s one more rule you need to edit before you’re finished; it’s a tricky one, hidden deep within the CSS file. You’ll switch to All mode in the CSS Styles panel in order to make it easier to find and edit the rule.In the CSS Styles panel, click the All button to view All mode.As you know from previous tutorials, All mode shows you all of the rules that affect the page you’re working on, not just the rules that affect the current selection.
  2. Click the plus sign next to check_menu.css to expand the list of rules if it isn’t already expanded. (Macintosh users need to click the arrow to expand the list.)The check_menu.css file name is at the bottom of the All Rules pane, so you might need to scroll or resize the pane to see it.
  3. Scroll down and locate the rule that begins ul.MenuBarHorizontal a.MenuBarItemHover . . . (The rule is so long I don’t even want to spell the whole thing out.) It’s immediately below the ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus rule that you were just editing in Current mode (see Figure 26).

Select the world's longest CSS rule.

Figure 26. Select the world’s longest CSS rule.

Once you’ve located the rule, click it to select it.

You now need to do exactly the same thing that you did for the ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus rule. Sorry, but it’s just the way the CSS for the Menu Bar widget is written, and if you don’t change this rule, too, the hover states will not work as you intend them to work.

  1. In the Properties pane, click the blue box in the background-color value field and use the eyedropper to select black ( #000 ).
  2. Click the #FFF default color in the color value field, change it to #00ADEF (that’s zero, zero, A, …), and press Enter/Return.Note that nothing has happened in Design view for awhile. Why? Because you’ve only been editing properties that affect the hover and focus states of the menu bar. To see those states, you need to enter Live View and test the widget again.But first, you need to save the CSS file so that the changes can take effect.
  3. Select File > Save All Related Files.
  4. Click the Live View button, and hover over the items in your menu bar.
  5. The menu is still in the wrong place, so select the #check_menu style rule in the CSS Styles panel (it’s in check_cs5.css), and click to the left of the top property to disable it. The menu drops into place. The hover background color is now black, and the hover text color is the blue you defined (see Figure 1).
  6. Hold down the Ctrl key (Windows) or the Cmd key (Mac OS X), and click one of the links. The news.html page loads into Live View.

The menu loads news.html into Live View.

Figure 27. The menu loads news.html into Live View.

  1. The menu in news.html is only an image, so click the Home or Back button on the Browser Navigation bar to return to index.html.Note: Live View navigation works only in Dreamweaver CS5. If you are using an older version of Dreamweaver, you need to test the links by previewing the index page in an ordinary browser.
  2. Click the Live View button to exit Live View. The menu moves back to the top of the banner image. If you want to do any further work on it, re-enable the top property for the #check_menu style rule. However, the top property should remain commented out when the page is uploaded to a remote server.

It’s unfortunate that Design view can’t handle the position of the menu accurately, but that’s what Live View is for—to test the way the page will look in a standards-compliant browser. Design view should only ever be taken as an approximation, although most of the time, it’s a very close one.

Add a top-level heading to the page

There’s just one final tweak that you need to make to index.html before it’s complete. The page doesn’t have a top-level heading ( <h1> ). The design uses the banner image instead. This looks fine in a browser, but search engines and screen readers expect pages to be organized with a proper hierarchy of headings: <h1> at the top of the page, <h2>for sideheads, and <h3> for subsections. You rarely need to use deeper levels of headings, and you should never choose a particular level just because of its default size. As you have seen throughout this tutorial series, you can use CSS to change the default look of a tag.

The problem with adding an <h1> tag to this page is that it will destroy the design. Well, it would if it weren’t for the magic of CSS. You can use absolute positioning to move the heading out of view. People visiting the site in a visual browser see the banner as normal, but search engines, text browsers, and screen readers see the <h1> at the start of the page.

Here’s how you do it.

  1. You need to add the <h1> tag between the opening <div> tags of the container and banner divs. The obvious way of doing this is to switch to Code view, and add it manually. However, I’d like to show you a neat trick to get the insertion point in the right place.Click anywhere inside the banner at the top of the page. Then select <div#banner> in the Tag selector at the bottom of the Document window. This selects the whole div.
  2. Press the left arrow key once. If you check in Split view, you’ll see that the insertion point is to the left of the opening tag of the banner div.
  3. In the Property inspector, make sure the HTML button is selected, and choose Heading 1 from the Format pop-up menu. This inserts a pair of <h1> tags between the two <div> tags, and opens up a large blank space above the banner image.
  4. In Design view, click in the space that has just opened up, and type Check Magazine: Fashion and Lifestyle (see Figure 28).

Adding a top-level heading to the page.

Figure 28. Adding a top-level heading to the page.

  1. Open the CSS Styles panel, which should still be in All mode, and scroll up to the #container rule in check_cs5.css. Select it, and click the New CSS Rule button at the bottom right of the CSS Styles panel.
  2. If your insertion point is still inside the heading, the New CSS Rule dialog box should already have the correct settings. Check that they look like Figure 29, and amend them if necessary.

Creating a new CSS rule for the top-level heading.

Figure 29. Creating a new CSS rule for the top-level heading.

Note: The value in the Selector Name text box is #container h1 . This is a descendant selector that affects <h1>tags in the container div. Normally, a page should have only one <h1> tag, so you could use h1 on its own. However, the selection made by Dreamweaver is fine.

  1. Click OK to open the CSS Rule Definition dialog box, and select the Positioning category.
  2. Select absolute from the Position pop-up menu.
  3. In the Top text box, type -500 (minus 500), and set the pop-up menu alongside to px.
  4. Click OK to close the CSS Rule Definition dialog box, and select File > Save All Related Files.
  5. Test the page in Live View, and BrowserLab. The top-level heading is tucked out of sight, 500 pixels above the container div. You can’t see it, but search engines, text browsers, and screen readers can.

Congratulations! You’ve finished the index.html page for Check Magazine, and the client is very pleased. If you want to compare your work against the completed files for the series, download the first_website_pt5_completed ZIP file.

The last thing you need to do is publish the page and its assets to a web server so that other people can view your work. I’ll show you how to do that in the next tutorial, Part 6: Publishing your website

Adobe Dreamweaver CS5 – Part 4: Adding the main image text


Adobe Dreamweaver CS4 logo

Image via Wikipedia

Welcome to Part 4 of this tutorial series on creating your first website. This tutorial shows you how to add text to the main image area of the index page for Check Magazine, a fictional publication, using a combination of relative and absolute positioning. The tutorial also shows you how to use CSS to format the text.

Locate your files and review your task

In this tutorial, you’ll begin with the CSS layout (index.html) you added content to in Part 3, Adding content to pages. If you did not complete that tutorial, you must complete it before proceeding, or downloadfirst_website_pt3_completed.zip (474 KB). If you haven’t completed Part 1, Setting up your site and project files, you will need to complete that tutorial as well.

Your task in this tutorial is to add a block of text to the main image area of the Check Magazine home page. You’ll also learn how to format the text using CSS. Figure 1 shows what the main image area will look like in a browser after you’ve added the text.

The main image area of the Check Magazine home page with added text.

Figure 1. The main image area of the Check Magazine home page with added text.

Basically what you’ll do to accomplish this task is add a div with text to the main image area, format the text, and lastly, position the div.

Add the div tag and text

Although the main_image div looks as though it’s filled with a large image, there’s actually nothing inside the div. The image is simply the background. If you look at the original design comp again, you’ll see that to finish the page, you need to add a block of text at the bottom right of the div. You also need to add a menu bar, but you’ll tackle that in Part 5. First, let’s deal with the text in the main_image div.

The text consists of two headings and a paragraph, so you need to create a div to hold them all together, and nest it inside the main_image div.

  1. In Dreamweaver, open the index.html file that you created in Part 3, Adding content to pages.
  2. The most accurate way of inserting a new div is to use the options in the Insert Div Tag dialog box. It doesn’t matter where the Insertion point is, the options enable you to insert the div accurately, as long as your page elements have IDs. All the divs in index.html have been given IDs, so it’s just a question of choosing the correct options in the dialog box.Click Insert Div Tag in the Insert panel, or select Insert >Layout Objects > Div Tag to open the Insert Div Tag dialog box.
  3. Click the down arrow of the Insert pop-up menu to reveal the options (see Figure 2).

View the options for where to insert the new div tag.

Figure 2. View the options for where to insert the new div tag.

The options available are:

  • At insertion point. The new div is inserted wherever the Insertion point currently is.
  • Before tag. The new div is inserted immediately before the specified element’s opening tag.
  • After start of tag. The new div is inserted immediately after the specified element’s opening tag.
  • Before end of tag. The new div is inserted immediately before the specified element’s closing tag.
  • After tag. The new div is inserted immediately after the specified element’s closing tag.
  • Wrap around selection. This option is displayed only when something is selected in the document window. The new div is wrapped around the selected element(s).
  1. The new div needs to be nested inside the main_image div, so it needs to go after the starting tag of main_image. Set the Insert pop-up menu to “After start of tag.” (Because the main_image div is empty, you could also use “Before end of tag” in this case.)This activates a new pop-up menu to the right of the Insert pop-up menu.
  2. Click the down arrow of the new pop-up menu to reveal its contents. It lists the <body> tag, along with all other page elements that have an ID (see Figure 3).

Select the main_image div from the list.

Figure 3. Select the main_image div from the list.

  1. Select <div id=”main_image”> from the list.
  2. Type main_text in the ID text box.
  3. Click the New CSS Rule button at the bottom of the Insert Div Tag dialog box. This opens the New CSS Rule dialog box.
  4. Dreamweaver automatically selects the correct values for Selector Type (ID) and Selector Name (#main_text).However, you need to check that Rule Definition is set to check_cs5.css. If it says “This document only,” select check_cs5.css from the Rule Definition list.
  5. Click OK to open the CSS Rule Definition dialog box, and select Background from the Category list on the left.
  6. Click the Background-color color box, and select white (#FFF), as shown in Figure 4.

Set the CSS background-color property for main_text to white.

Figure 4. Set the CSS background-color property for main_text to white.

  1. Select Box from the Category list on the left.
  2. Type 300 in the Width text box, and make sure the pop-up menu alongside is set to px (see Figure 5). This sets the width of the main_text div to 300 pixels.

Set the width of the main_text div to 300 pixels.

Figure 5. Set the width of the main_text div to 300 pixels.

  1. Click OK. This saves the new CSS rule, and brings you back to the Insert Div Tag dialog box.
  2. Click OK to close the Insert Div Tag dialog box. This inserts the main_text div with some placeholder text.
  3. Click anywhere in the Document window away from the new div to deselect the placeholder text. The main_image div should now look like Figure 6, with a 300-pixel wide, white box containing placeholder text at the top left.

The main_text div has been nested inside the main_image div.

Figure 6. The main_text div has been nested inside the main_image div.

The white background of the main_text div covers the background image, so the text can be clearly read.

  1. Now, it’s time to insert the final text. In the Files panel (Window > Files), double-click the text.txt file to open it.
  2. Select the entirety of the last block of text in the file, everything from “OPERATIVE WORDS” up to and including “. . . hiding in his bathroom.”
  3. Copy the text by selecting Edit > Copy, by right-clicking and selecting Copy from the context menu, or pressing Ctrl+C/Cmd+C.
  4. Close the text.txt file.
  5. Select the placeholder text for the main_text div, and paste the text from your clipboard by pressing Ctrl+V/Cmd+V, or selecting Edit > Paste.The text you copied from text.txt replaces the placeholder text, and the main_text div automatically expands vertically to accommodate it (see Figure 7).

The main_text div is now ready to be formatted and positioned.

Figure 7. The main_text div is now ready to be formatted and positioned.

  1. Select File > Save All Related Files to save index.html and the style sheet.

Rearrange CSS

Before showing you how to format your text, I’d like you to take a look at the CSS. As you’ve been creating rules, Dreamweaver has been adding the CSS to the external style sheet for you. However, because you’ve created the rules at different points in the page’s development, they are not necessarily in the most logical order. I like to have my CSS ordered logically so that if I want to edit the style sheet later on, I’ll have an easier time scanning and finding the rule I’m interested in.

  1. Click check_cs5.css in the Related Files toolbar to open the style sheet in Split view (see Figure 8).

The styles you have created so far.

Figure 8. The styles you have created so far.

  1. Scroll down to the bottom of the CSS file, and note that the #main_text rule is the last rule on the page. That’s because you just added it in the previous section. Also note that the body rule is third from the bottom.Because the body rule affects the entire page (corresponding to the <body> tag of the HTML document), it’s usually the first rule in the CSS file. But since you created it after you created some of the other rules, Dreamweaver placed it farther down in the file.Similarly, the #main_text rule goes hand-in-hand with the #main_image rule, and doesn’t belong at the bottom of the CSS file. In other words, if you were looking for all of the rules that affect that central section of the page, you’d want to see these two rules grouped together in the CSS file.

    Another problem is that the body and #main_text selectors (on lines 25 and 31 in Figure 8) are on the same line as the closing brace of the previous rule. This happens if you don’t leave a blank line at the bottom of the style sheet when creating a new rule manually. It doesn’t affect the way the browser handles the style rules, but untidy code is difficult to read, and could lead to mistakes. It’s better to reformat it.

    You could work directly in the CSS file, cutting and pasting until you get the file to look the way you want. However, I’m going to show you another way.

  2. Select Commands > Apply Source Formatting. Dreamweaver sweeps through the style sheet, putting rules on lines of their own, and tidying up any indenting problems.
  3. If the CSS Styles panel isn’t already open, click its tab to open it.
  4. Click the All button to make sure All mode is selected.You’ll see all of your rules listed. The order of the rules in the CSS Styles panel follows the same order as the style sheet (that is, #main_text is last, body is third from the bottom).
  5. Select the body rule and drag it to the top of the rules list, above the #container rule (see Figure 9).

Drag the body rule to the top of the rules list in the CSS Styles panel.

Figure 9. Drag the body rule to the top of the rules list in the CSS Styles panel.

  1. Look at the style sheet in Split view. The body rule has been moved above the #container rule (see Figure 10).

The body rule has been moved in the style sheet as well.

Figure 10. The body rule has been moved in the style sheet as well.

Note: Don’t worry if you see the comment text /* CSS Document */ in between the body rule and the#container rule (see line 7 in Figure 10), you can go ahead and delete it. This is just descriptive comment text that Dreamweaver adds to the file by default.

  1. Next, select the #main_text rule and drag it up the list, dropping it just below the #main_image rule, as shown in Figure 11.

Drag the #main_text rule.

Figure 11. Drag the #main_text rule.

Your rules now follow a more logical order: first comes the body rule, which governs the entire page, then the#container rule, which also governs the other rules, since all of the elements associated with those rules exist within the container div. Then come the rules associated with each element on the page, ordered as those elements appear on the page: the main image, the main text, and the columns at the bottom.

  1. Save the style sheet.

Format the text

Next you’ll format the text inside the main_text div.

  1. The index.html file should still be open in the Document window. If it isn’t, double-click its icon in the Files panel to open it.
  2. Click the Design view button so that you are no longer in Split view.
  3. Place the Insertion point after WORDS at the end of the first line in the main_text div, and press Enter (Windows) or Return (Mac OS X) to divide the text into separate paragraphs.
  4. Press the down arrow key once so that the Insertion point is before the word Stumbling, and press the Backspace key once to delete line break. This is the same technique as you used when breaking up the text you pasted in Part 3 of this tutorial series.
  5. Place the Insertion point after the word Circle at the end of the second line in the main_text div, and press Enter (Windows) or Return (Mac OS X) to create a new paragraph.
  6. Press the down arrow once to place the Insertion point before the capital letter T in the word The, and press the Backspace key once to delete the line break. There should now be three separate paragraphs in the main_text div (see Figure 12).

The text has been split into three paragraphs.

Figure 12. The text has been split into three paragraphs.

  1. Make sure the Property inspector is open (Window > Properties) and that the HTML button on the left of the Property inspector is selected.
  2. In the main_text div, place the Insertion point in the OPERATIVE WORDS line (anywhere in the line will do), and note that the Format is set to Paragraph in the Property inspector. This is the format Dreamweaver automatically created when you pressed Enter/Return to separate the lines of text.
  3. Select Heading 2 from the Format pop-up menu of the Property inspector.Note that you do not need to select the entire line of text before applying a format. This is because Dreamweaver is formatting the text by changing the text’s entire tag (from a paragraph tag to an h2 tag).
  4. Place the insertion point in the second line, the Stumbling line.
  5. Select Heading 3 from the Format pop-up menu of the Property inspector.
  6. Click the Split view button so that you can see the new tags (see Figure 13).Note: If the style sheet is still visible when you open Split view, select Source Code in the Related Files toolbar just below the page’s tab.

The h2, h3, and paragraph tags in Code view.

Figure 13. The h2, h3, and paragraph tags in Code view.

These tags are important. You’ll use them in the CSS to define the rules that will format the text.

  1. Click the check_cs5.css button in the Related Files toolbar to display the contents of the style sheet.
  2. In the CSS file, place the Insertion point after the closing brace of the #main_text rule and press Enter/Return a bunch of times to create some space (see Figure 14).

Creating space in the CSS file.

Figure 14. Creating space in the CSS file.

  1. Move the Insertion point back up until it’s just below the closing brace of the #main_text rule (you can use the up arrow key on your keyboard, or the mouse), and type the following empty rules into the file:

#main_text h2 { } #main_text h3 { } #main_text p{ }

The selectors for these rules (that is, the names outside the braces that define the rules) are called descendant selectors because they target HTML elements that are descendants of another element (in other words, nested inside it). The first of these selectors targets <h2> tags inside the #main_text div. What this means is that any styles defined in this rule will have no effect on the <h2> tags in the columns at the bottom of the page.

The second rule affects <h3> tags only if they’re inside the #main_text div. And the last one formats paragraphs (<p> tags) only if they’re inside the #main_text div.

Note: When using the New CSS Rule dialog box to create descendant selectors, you need to set the Selector Type pop-up menu to Compound. This is Dreamweaver’s way of describing CSS selectors that are created using multiple elements.

  1. The CSS file should now look as shown in Figure 15.

The CSS file with the new empty rules.

Figure 15. The CSS file with the new empty rules.

  1. Now, add the following properties and values to the empty rules so that they look like this:

#main_text h2 { color: #00b4e1; } #main_text h3 { font-size:16px; } #main_text p { font-size: 14px; }

  1. Once you’ve added properties to all three rules, press F5 or click once in Design view to refresh the display.Look what happened to the text. The h2 heading has turned blue; the h3 heading has been resized, and now fits on one line; and the paragraph text has been reduced in size (see Figure 16).

The main_text div text after applying new rules.

Figure 16. The main_text div text after applying new rules.

Note: For many years, it was recommended not to use pixels for the font-size property because the world’s most popular browser at the time, Internet Explorer 6, made it difficult for people with poor eyesight to resize the text. However, Internet Explorer 7 introduced a zoom feature, and issue is becoming less of a problem as Internet Explorer 6 gradually dies away.

You’re not quite there yet. The three sections of text are still a bit too spread out, and the paragraph text is bumping right up against the walls of the main_text div. You need to add a few more properties and values to fix that.

  1. Add three more properties and values to the #main_text rule, so that it looks as follows:

#main_text { background-color: #FFF; width: 300px; line-height: 1.2; font-family: "Myriad Pro", Helvetica, Arial, sans-serif; padding: 12px;}

The line-height property will increase the vertical space between all lines in the main_text div. (Yes, you do actually want to increase the general line height in the div—you’ll see why in a moment.) The font-family property will change the font of all the text in the div, and the padding property will add a 12-pixel padding inside the div.

Note: When you have a single value for padding, it acts as a shorthand value for top, bottom, left, and right. It is the equivalent of saying:

padding-top: 12px; padding-bottom: 12px; padding-left: 12px; padding-right: 12px;

  1. Refresh Design view by clicking inside it or pressing F5 to see how the new properties have affected the text.Lastly, get rid of some of the vertical space between the blocks of text, and condense the div.
  2. Add a margin property to the #main_text h2 rule, the #main_text h3 rule, and the #main_text p rule, so that the rules look as follows:

#main_text h2 { color: #00b4e1; margin: 0 auto; } #main_text h3 { font-size:16px; margin: 0 auto; } #main_text p { font-size: 14px; margin: 0 auto; }

The syntax for the margin property above is another short-hand notation, much like the one for padding in the previous step. When you declare only two values for the margin property, the first value declares the top and bottom values, and the second value declares the left and right values. By declaring a top and bottom margin of 0 for all three of these rules, you are effectively saying that there should be no extra space (other than the 1.2 line height) between the h2, the h3, and the paragraph text. The auto value in this case simply specifies the default value for the right and left of the h2, h3, and paragraph elements.

Tip: For more information about any CSS property, check the O’Reilly reference guide included with Dreamweaver. To display the guide, select Help > Reference and select O’Reilly CSS Reference from the Book pop-up menu in the Reference panel.

  1. Refresh Design view to see how the margin properties have affected the text (see Figure 17).

The main_text div after you have added margin properties and applied the rules.

Figure 17. The main_text div after you have added margin properties and applied the rules.

The text is looking pretty good, but before you go ahead and position the div, let’s check to see what the text formatting looks like in Live view.

  1. Click the Live view button.Design view displays the page in Live view (see Figure 18).

The formatted main_text div as it appears in Live view.

Figure 18. The formatted main_text div as it appears in Live view.

Hmm . . . that’s not exactly what I wanted. Monitors might differ, but on my screen the OPERATIVE WORDS h2 text still seems a little too close to the h3 text in Live view. Let’s fix that by adjusting the margin of the h2 heading one last time.

  1. Leaving Live View active, go back to the CSS file, and change the #main_text h2 rule to this:

#main_text h2 { color: #00b4e1; margin-top: 0; margin-bottom: 10px; }

  1. Refresh Live View by clicking back inside or pressing F5, and note the change (see Figure 19).

The main_text div after adjusting the margin properties for the h2.

Figure 19. The main_text div after adjusting the margin properties for the h2.

That’s much better!

  1. Click the Live View button to exit Live View.
  2. Select File > Save All Related Files to save the CSS file.

Position the main_text div

Now that you have the main_text div looking exactly the way you want, the final task is to position it on the page. There are several ways of doing this.

The approach taken in the original version of this tutorial series was to add padding to the top and left of the main_image div. This achieved the desired result, but many readers found it difficult to follow, because of the way CSS treats width and height when padding is added to an element. The CSS box model adds padding outside the width and height, not inside. As a result, to move the main_text div to the bottom right of the main image, you needed to subtract from the width and height of the main_image div the same amount as you added in padding. In other words, to add 100 pixels of padding to the top of the div, you needed to subtract 100 pixels from its height, so that the total of padding plus height still came to the same amount. Moreover, positioning the main_text div like this was possible only because the main_image div was empty. If you wanted to put more than one block of text inside the main_image div, the calculations became even more complex.

The approach I have decided to adopt this time is to use absolute positioning. Before showing you how to do it, I must sound a word of warning. Many beginners fall into the trap of trying to lay out their entire design with absolute positioning (or AP Divs, as Dreamweaver calls them). The attraction of absolute positioning is that you can place an element precisely on a page, making web design feel almost like desktop publishing. However, the web is a fluid medium. People view pages on different size monitors, and at different resolutions. Absolutely positioned elements behave in a very different way from other elements. They stay where you put them, and don’t interact with the rest of the page. So, it the user resizes the browser, an absolutely positioned element might disappear off screen. The browser doesn’t generate a scrollbar when this happens, so vital information might become inaccessible.

However, if used carefully, absolute positioning can be very effective, particularly when you want to align an element with a background image. In this case, the plan is to position the bottom right corner of the main_text div slightly above and to the left of the white cross at the bottom of the main image (see Figure 1).

  1. Click the Design button to view index.html in Design view.
  2. (Optional) Press F4 to hide the panels. You need to get a good view of the page layout, particularly of the main image.
  3. Select View > Rulers > Show. This adds rulers measured in pixels at the top and left of the Document window.
  4. Click inside the top ruler and drag down. As you drag, you should see a thin, green, horizontal line move down the page, with a yellow tooltip indicating how many pixels it is from the top of the page (circled in Figure 20).

Dragging a horizontal guide from the ruler at the top of the page.

Figure 20. Dragging a horizontal guide from the ruler at the top of the page.

  1. Continue dragging until the green line is flush with the bottom of the main image (around 491 px).
  2. Drag another guide from the top ruler until it’s in line with the position above the white cross where you would like the bottom of the main_text div to be. The exact position isn’t important. Use your eye to judge what looks good.
  3. Make sure your cursor pointer is between the green guides you have just positioned on the page, and hold down the Ctrl key (Windows) or the Cmd key (Mac OS X). Dreamweaver displays the distance in pixels between the two guides (see Figure 21).

Measuring the distance between the guides.

Figure 21. Measuring the distance between the guides.

  1. Make a note of the value.
  2. Drag two guides from the left ruler, and position them in line with the right edge of the main image and where you would like the right edge of the main_text div to be.
  3. Position your cursor pointer between the vertical guides and hold down the Ctrl key (Windows) or the Cmd key (Mac OS X), and make a note of the distance.
  4. The white cross is equidistant from the bottom and right edges of the main image, so the horizontal and vertical distances should be the same. I find that 60 pixels is about right.If you have difficulty positioning the guides, double-click one of the guides to open the Move Guide dialog box, and set the position by typing a value in the Location text box. Use 431 px for the horizontal guide. The value for the vertical guide will depend on the size of the Document window. Double-click the guide on the right edge of the main image to find its position, subtract 60, and use that value for the main_text vertical guide.
  5. Open the CSS Styles panel by clicking its tab, or by selecting Window > CSS Styles.
  6. Make sure the All button is selected to view the panel in All mode.
  7. Double-click #main_text to reopen the CSS Rule Definition dialog box for the #main_text style rule.
  8. Select Positioning from the Category list on the left, and add the following settings:
    • Set the value of the Position pop-up menu to absolute.
    • Type 60 in the Right and Bottom text boxes, and make sure the pop-up menus alongside are set to px.
    • Click Apply.

Using absolute positioning for the main_text div.

Figure 22. Using absolute positioning for the main_text div.

  1. Don’t worry if the main_text div remains stubbornly at the top-left of the main image div. Click OK to close the CSS Rule Definition dialog box, and select File > Save All Related Files to save the style sheet. The main_text div should move into position with its right and bottom edges aligned precisely with the green guides.Note: If the main_text area still doesn’t move. Try closing index.html and reopening it.
  2. Click the Live View button to verify the text is in the correct position (see Figure 23).

Live View confirms that the text is correctly positioned.

Figure 23. Live View confirms that the text is correctly positioned.

  1. With Live View still active, select #main_image in the CSS Styles panel, and move your cursor pointer over the left side of the Properties pane until you see the Disable CSS Property symbol next to the position property (see Figure 24).

Temporarily disabling a property in the CSS Styles panel

Figure 24. Temporarily disabling a property in the CSS Styles panel

  1. Click once to disable the position property. A red symbol appears alongside the property to indicate that it has been disabled.Note: The ability to disable style rules temporarily is new to Dreamweaver CS5. If you are using an older version of Dreamweaver, you will need to open the style sheet and manually comment out the position: relative;declaration.Look what has happened to the main_text div. It has moved from its previous position(see Figure 25).

The position of the main_text div is no longer relative to the main_image div.

Figure 25. The position of the main_text div is no longer relative to the main_image div.

The actual position of the main_text div depends on the size of your Document window. Instead of being positioned relative to the bottom and right of the main_image div, it’s now 60 pixels from the bottom and right edge of the Document window.

  1. Click the Disable CSS Property icon alongside the position property to re-enable it. The main_text div jumps back into place.What’s important to understand here is that the main_text div is nested inside the main_image div. In CSS terms,#main_text is the child of #main_image , and #main_image is the parent of #main_text . By setting theposition property of the parent to relative , the child is absolutely positioned relative to its parent. When you disabled the position property in #main_image , the absolute position of #main_text was calculated relative to the bottom and right edges of the browser window (in this case, Live View).
  2. Select File > Save All Related Files to save the page and the style sheet.
  3. Open the BrowserLab panel by clicking its tab, or by selecting Window > BrowserLab, and click Preview. Verify that the page looks as expected in all major browsers. Even Internet Explorer 6 plays ball.
  4. Select View > Guides > Clear Guides to remove the green guide lines from Design view.

Used in moderation, absolute positioning can be very helpful in situations like this. By using the bottom and right offsets, the bottom-right corner of the main_text div will remain in the same position, but it will grow taller if you add more text. A common mistake with using absolute positioning is the failure to realize that web pages are designed to be flexible. If you use absolute positioning for text elements, adding extra text is likely to result in one element overlapping another. It’s also important to understand the principle of anchoring an absolutely positioned element inside its parent by setting the parent’s position property to relative .

You have one more task to accomplish before the page is complete. In Part 5: Adding the spry menu you’ll add a Spry Menu Bar widget to the top of the page so that users can navigate the website.

Adobe Dreamweaver CS5 – Part 3: Adding content to pages


Adobe Dreamweaver CS4 logo

Image via Wikipedia

Requirements

Welcome to the third part of this tutorial series on creating your first website. This tutorial shows you how to add content to web pages in Adobe Dreamweaver CS5/CS5.5. You can add many different kinds of content to web pages, including graphics, text, links, and Spry widgets—to name just a few. After you’ve added content to your pages, you can preview your work in Dreamweaver so that you can see what it will look like on the web.

Note: You won’t be adding a Spry widget to the page until Part 5 of this tutorial series, Adding the Spry menu.

Locate your files and review your task

In this tutorial, you’ll begin with the CSS layout (index.html) you created in Part 2, Creating the page layout. If you did not complete that tutorial, you must complete it before proceeding, or download first_website_pt2_completed.zip(475 KB) and begin with those. All the required assets for this tutorial are in the check_cs5 local site folder that you set up in Part 1. If you are using the completed files from Part 2, follow the instructions in Part 1 for setting up the Check Magazine site on your local computer.

Your task is to add assets to the home page for Check Magazine, a fictional publication. You’ll learn how to add images, text, and links. You’ll also learn how to format text using CSS. Figure 1 shows what the finished page will look like at the end of Part 3.

The page after you have entered content into it.

Figure 1. The page after you have entered content into it.

Insert images

After you create your page layout, you are ready to add assets to the page, starting with images. You can use several methods to add images to a web page in Dreamweaver. In this section, you’ll add three images to the Check Magazine page using various methods.

Insert an image by using the Insert menu

In Part 2, you used the Insert panel to insert an image. This time, you’ll use the Insert menu.

  1. In Dreamweaver, open the index.html file that you created in Part 2, Creating the page layout.
  2. Delete the placeholder text in the left_column div. Make sure the Insertion point remains inside the div (see Figure 2). (In other words, make sure you don’t click anywhere outside the div after you’ve deleted the placeholder text.)

The left_column div with the placeholder text deleted.

Figure 2. The left_column div with the placeholder text deleted.

  1. Press Enter (Windows) or Return (Mac OS X) once to create more space in the div.
  2. Press the up arrow on your keyboard to move the Insertion point back up to the top of the div, and click the Split button to see what has happened in the underlying code. Dreamweaver has inserted two paragraphs ( <p> tags), each with &nbsp; inside them (see Figure 3).

Dreamweaver has inserted two empty paragraphs in the div.

Figure 3. Dreamweaver has inserted two empty paragraphs in the div.

Note: The &nbsp; is the HTML entity (code that represents a special character) for a nonbreaking space. It’s there to make the paragraph easier to select in Design view. Dreamweaver normally deletes it automatically as soon as you start typing or insert anything into the paragraph.

  1. Select Insert > Image.
  2. In the Select Image Source dialog box, navigate to the site’s images folder, select the car.jpg file, and click OK (Windows) or Choose (Mac OS X).
  3. Dreamweaver displays the Image Tag Accessibility Attributes dialog box (unless you’ve changed the default preferences).Type Car in the Alternate Text text box and click OK.The image appears in Design view, and Dreamweaver inserts the necessary HTML in the underlying code, removing the nonbreaking space in the process (see Figure 4).

The inserted car image and the underlying code.

Figure 4. The inserted car image and the underlying code.

  1. Leave the image selected (in other words, don’t click anywhere else on the page), and look at the Property inspector at the bottom of the Dreamweaver application window. (If the Property inspector is hidden, you can display it by selecting Window > Properties).

The Property inspector displays all of the properties for whatever asset you have selected in the Document window. Since we have our new image selected, the Property inspector is displaying the properties for the car.jpg image. You can see that the Property inspector displays the width and height of the image, the file path to the image, and the alternate text that you specified before inserting the image (see Figure 5).

The Property inspector displaying image properties.

Figure 5. The Property inspector displaying image properties.

The Property inspector is one of the most powerful tools in Dreamweaver. You can use it to change properties for any selected asset on your page at any time.

Note also that the <img> tag is selected in the Tag selector (at the bottom of the Document window)—yet another way that Dreamweaver communicates the precise selection of page assets.

Now let’s add the remaining images.

Insert an image by dragging

To insert an image by dragging:

  1. Delete the placeholder text in the center_column div. Make sure the Insertion point remains inside the div.
  2. Press Enter (Windows) or Return (Mac OS X) once to create more space in the div.
  3. Press the up arrow on your keyboard to move the Insertion point back up to the top of the div.
  4. In the Files panel (Window > Files), locate the data_addict.jpg file (it’s inside the images folder) and drag it to the insertion point in the center_column div (see Figure 6).Important: Make sure you drag the data_addict.jpg to the Insertion point at the top of the center_column div. It’s easy to mistakenly drop the image in the lower half of the div when dragging.

Drag the data_addict.jpg file to the insertion point in the center_column div.

Figure 6. Drag the data_addict.jpg file to the insertion point in the center_column div.

  1. In the Image Tag Accessibility Attributes dialog box, type Data in the Alternate Text text box and click OK.The image appears on your page. You can see all of its properties in the Property inspector.
  2. Save the page. It’s important to save often!

Insert an image from the Assets panel

To insert an image from the Assets panel:

  1. Delete the placeholder text in the right_column div. Make sure the Insertion point remains inside the div.
  2. Press Enter (Windows) or Return (Mac OS X) once to create more space in the div tag.
  3. Press the up arrow on your keyboard to move the Insertion point back up to the top of the div.
  4. Click the Assets tab in the Files panel group, or select Window > Assets to make your site assets appear.The images category in the Assets panel is selected by default. If it isn’t selected, click the Images button to view your image assets (see Figure 7).

The Images category of the Assets panel.

Figure 7. The Images category of the Assets panel.

The Assets panel displays assets for the site associated with the active document in the Document window. In the screen shot, you can see that the Assets panel displays the selected image asset in the preview area.

  1. In the Assets panel, select the helmet.jpg file.
  2. Do one of the following to insert the helmet.jpg file in the page:
    • Drag the helmet.jpg file to the insertion point in the right_column div.
    • Click Insert at the bottom of the Assets panel.
  3. In the Image Tag Accessibility Attributes dialog box, type Helmet in the Alternate Text text box and click OK.
  4. Save the page, which should now look as shown in Figure 8.

The page after inserting images in the columns.

Figure 8. The page after inserting images in the columns.

For more information on working with the Assets panel, see Working with Assets in Dreamweaver Help.

Insert text

Now you’ll add text to the page. You can type text directly in the Document window or you can copy and paste text from other sources (such as Microsoft Word or plain text files). Later, you’ll use CSS to format the text.

  1. Return to the Files panel by clicking its tab.
  2. In the Files panel, locate the text.txt file (in the check_cs5 root folder) and double-click the file’s icon to open it in Dreamweaver.You’ll notice that this window is in Code view (see Figure 9) and cannot be switched to Design view because it’s not an HTML file.

The text file opens in Code view only.

Figure 9. The text file opens in Code view only.

  1. In the text.txt Document window, select the first block of text (beginning with “Inside Tesla Motors®” up to and including “read more…”).
  2. Copy the text by pressing Ctrl+C/Cmd+C, or by selecting Edit > Copy. Alternatively, you can right-click and select Copy from the context menu that appears.
  3. Leaving the text.txt file open, click the tab of the index.html document.
  4. Click inside the left_column div below the car image, placing the Insertion point in the same place where you created space earlier (see Figure 10).

The Insertion point placed below the car image in the left_column div.

Figure 10. The Insertion point placed below the car image in the left_column div.

  1. Paste the text by pressing Ctrl+V/Cmd+V, or by selecting Edit > Paste. Alternatively, right-click and choose Paste from the context menu that appears.

The text is displayed in the div (see Figure 11).

The Inside Tesla Motors® text pasted in the div.

Figure 11. The Inside Tesla Motors® text pasted in the div.

Don’t worry about the look of the text. You’ll format it with CSS so that it looks more like the text in our design comp.

  1. Return to the text.txt file by clicking its tab.
  2. In the text.txt Document window, select the second block of text (beginning with “Facts and Figures” up to and including “read more…”).
  3. Copy the text.
  4. Leaving the text.txt file open, click the tab of index.html.
  5. Click inside the center_column div below the data image, placing the Insertion point in the same place where you created space earlier.
  6. Paste the text.
  7. And one last time, return to the text.txt file by clicking its tab.
  8. In the text.txt Document window, select the third block of text (beginning with “Today’s Self Improvement” up to and including “read more…”).
  9. Copy the text.
  10. Close the text.txt file by clicking the X in the upper-right corner of its tab. (You won’t need the remaining text until later.)
  11. On the index.html page, click inside the right_column div below the helmet image, placing the Insertion point in the same place where you created space earlier.
  12. Paste the text.Your three columns are now filled with text (see Figure 12).

The text in all three columns.

Figure 12. The text in all three columns.

  1. Save the index.html page.

Now all you need to do is format the text so that it looks more like what the designer intended.

Format text with CSS

In Part 2, Creating the page layout, you learned how to insert div tags and then position those tags on the page to create the layout. You separated content (the HTML div tags) from presentation (the CSS that controls the layout) by creating new CSS rules, placing them in an external style sheet, and then applying them to the div tags on your page. In a nutshell, you learned that you can insert elements on a page and create styling rules in a linked CSS page, and that when you apply those styling rules to particular elements on a page, those elements are directly affected by the rules.

Well, the same holds for text on a page. CSS is used to format text as much as it is to position div tags. You type or paste your text on the page, create a CSS rule, and then apply the rule to the text, just as you would apply it to a div. In fact, all text is contained within some sort of tag—it might be a div, but it could also be a paragraph tag ( <p> ), a heading tag ( <h1> , <h2> , etc) or any other kind of tag. Normally what you do when you format text with CSS is apply the CSS rule to the particular tag that you want to format.

Before going on, I recommend that you read Understanding Cascading Style Sheets, a basic overview of how CSS works to format text. Having a little background information about the ins and outs of CSS will make the rest of this tutorial a lot easier to comprehend.

Now let’s format some text.

  1. Open the CSS Styles panel (Window > CSS) by clicking its tab.
  2. (Optional) If it’s not already closed, double-click the Insert panel to close it and create more room.
  3. In the CSS Styles panel, click the All button to make sure you are viewing All mode.Earlier, when you first used the CSS Styles panel to create a new rule, the panel displayed no rules because you hadn’t created any yet. Now that you have a bunch of rules applied to elements on the page, the CSS panel is displaying all of the pertinent rules (see Figure 13).

Layout rules in the CSS panel.

Figure 13. Layout rules in the CSS panel.

In addition to creating and attaching new rules, the CSS Styles panel lets you track the CSS rules and properties that affect the elements on the page. All mode lets you see all of the page’s rules at once, while Current mode lets you see the rules that apply to the current selection on the page. The CSS Styles panel also lets you modify CSS properties without opening an external style sheet.

There are a number of ways we could go about formatting your text. Beginners often create class rules and apply them to each paragraph, but that’s a very inefficient approach. It’s better to use CSS to apply an overall style first, and use classes and other CSS selectors only for those elements that you want to style differently.

For now, all you need is a nice font format and size, and since you want your format to be uniform across all three columns, you can simply define the font format in a rule for the body tag ( <body> ). The body tag is the topmost tag of the HTML page, which means that all other tags on the page (including all of our div tags) inherit the properties defined for the body tag. By defining your text properties in the body tag, you will effectively be defining text properties for all text that appears on the page.

  1. In the lower right-hand corner of the CSS Styles panel, click the New CSS Rule button.
  2. In the New CSS Rule dialog box, do the following:
    • Select Tag from the Selector Type pop-up menu.
    • Type or select body in the Selector Name text box.

    Note the description in the text box below the selector name. Dreamweaver is telling you that the rule you’re creating will apply to all <body> elements. That’s exactly what you want.

  3. Make sure check_cs5.css is selected from the Rule Definition pop-up menu.
  4. Click OK.The CSS rule definition dialog box appears, indicating that you are defining properties for the new body tag rule.
  5. Select the Type category in the Category column. (It should be selected by default.)
  6. In the Type category, do the following:
    • From the Font-family pop-up menu, select Trebuchet MS, Arial, Helvetica, sans-serif
    • Click the Color box and use the eyedropper tool to select black (#000).
    • Click Apply.

    As soon as you click Apply, all the text in Design view should be formatted with the new style (see Figure 14).

You can check the effect of your styles by clicking the Apply button.

Figure 14. You can check the effect of your styles by clicking the Apply button.

Tip: If you want to experiment with different styles, you can change the values in the CSS Rule Definition dialog box, and click Apply to see the effect immediately reflected in Design view.

  1. While you’ve got the CSS Rule Definition dialog open, you should set a background color for the <body> tag. Although current browsers set the background color to white, it’s generally recommended to set the color explicitly in your own style rules—and, of course, you can choose any color you like.Select Background from the Category list on the left.
  2. Click the Background-color color box, and select white (#FFF).
  3. Click OK to close the CSS Rule Definition dialog box.You’ll notice two things. One is that Dreamweaver has added the new body tag rule to the CSS Styles panel (see Figure 15).

The new body rule in the CSS Styles panel.

Figure 15. The new body rule in the CSS Styles panel.

The other thing you might notice is the asterisk (*) that appeared next to the check_cs5.css file name in the upper left-hand corner of your document (see Figure 16).

The asterisk in the Related Files toolbar reminds you to save the changes to the style sheet.

Figure 16. The asterisk in the Related Files toolbar reminds you to save the changes to the style sheet.

What Dreamweaver is showing you here is that you have an unsaved related file.

  1. Select File > Save All Related Files to save the changes you made to the style sheet.

Format headings and create links

Now you just need to do a couple more things to finish formatting the text in your columns.

Format headings

To format headings:

  1. In the left_column div, place the Insertion point after the ® symbol at the end of the first line, and press Enter (Windows) or Return (Mac OS X).Note that the Insertion point is now on a line above the following text. Open Split view to understand what has happened. There’s a line break ( <br /> ) tag immediately after the opening <p> tag (see Figure 17).

The text you pasted into the columns contains &lt;br /&gt; tags.

Figure 17. The text you pasted into the columns contains <br /> tags.

When you pasted the text from text.txt, the newline characters were converted to <br /> tags. This gives the impression of paragraphs, but causes problems for formatting the text correctly. Pressing Enter/Return created a closing </p> tag at the end of the first line, and an opening <p> tag at the beginning of the next line, but the <br />tag wasn’t removed, leaving too big a space between the paragraphs.

  1. Make sure the Insertion point is still in the same place, and press your down arrow once to move the Insertion point before the word The.
  2. Press Backspace to delete the unnecessary line break (see Figure 18).

The line break has gone, leaving two paragraphs.

Figure 18. The line break has gone, leaving two paragraphs.

This is a very important step. The main paragraph text must be completely separated from the heading before we apply a format to the heading.

  1. Click anywhere in the heading text. For example, click in the word Tesla. You do not need to select any text—you only need to make sure that the Insertion point is somewhere in the heading text.
  2. In the Property inspector (Window > Properties), make sure the HTML button on the left is selected.
  3. Select Heading 2 from the Format pop-up menu (see Figure 19).

Select Heading 2 from the Format pop-up menu in the HTML Property inspector.

Figure 19. Select Heading 2 from the Format pop-up menu in the HTML Property inspector.

The Inside Tesla Motors® heading changes to a Heading 2. The size and weight of the text you see here is the default size and weight for a Heading 2. In other words, you did not really need to apply any CSS to achieve this effect (though you could have!)

Now you’ll do the same thing with the remaining headings.

  1. In the center_column div, place the Insertion point after the word Figures at the end of the first line of text and press Enter (Windows) or Return (Mac).
  2. Press the down arrow once, to move the Insertion point before the word How at the beginning of the next line, and press Backspace to remove the line break.
  3. Click anywhere in the heading text. For example, click in the word Figures.
  4. In the Property inspector, select Heading 2 from the Format pop-up menu.The Facts and Figures heading changes to a Heading 2.
  5. Lastly, in the right_column div, place the Insertion point after the word Improvement at the end of the first line of text and press Enter (Windows) or Return (Mac OS X).
  6. Press the down arrow once to move the Insertion before the word Whether at the beginning of the next line, and press Backspace to remove the line break.
  7. Click anywhere in the heading text. For example, click in the word Improvement.
  8. In the Property inspector, select Heading 2 from the Format pop-up menu.The Today’s Self Improvement heading changes to a Heading 2.
  9. Save the page.

Create links

A link is a reference, inserted in a web page, that points to another document. You can turn almost any kind of asset into a link, but the most common kind of link is a text link. In this section, you’ll turn the “read more…” text in each of our three columns into links.

The check_cs5 site root folder contains a finished HTML page that you can link to (a news page for the magazine). You’ll use this page for all of the links in the columns, even though you would have distinct pages for each of these links if you were building a real site.

Note: The news.html page is a dummy page made up of images, and is not intended for practical use. A follow-up tutorial will later show you how to create a functioning version of the page using a database and PHP server-side technology.

  1. In the left_column div, select the “read more…” text at the end of the paragraph, including the periods (see Figure 20).Tip: Because there’s no gap between the text and the left side of the div, you might find it difficult to select the text from left to right. Click and drag from the right—it’s much easier.

Selecting text in the left_column div.

Figure 20. Selecting text in the left_column div.

  1. In the HTML Property inspector, click the folder icon next to the Link text box (see Figure 21).

Clicking the Folder icon in the Property inspector.

Figure 21. Clicking the Folder icon in the Property inspector.

  1. In the Select File dialog box, select the news.html file (which is in the same folder as index.html) and click OK (Windows) or Choose (Mac OS X).
  2. Click next to the “read more…” text to deselect the link. You’ll see that the text has transformed into a link, underlined and blue.
  3. Repeat the previous steps and link the “read more…” text in the remaining two columns to the news.html page. When you’re finished, your page should look as shown in Figure 22.

The three columns with linked text.

Figure 22. The three columns with linked text.

  1. Save the page.

You just created three links to a page that’s internal to our site. But you can also use the Link text box in the Property inspector to create links to external websites. To do so, simply select the text or element you want to link, and then type the website’s full URL in the Link text box of the Property inspector. For example, if you wanted to link the third “read more…” text in our example to adobe.com, you would select the text, type in the Link text box, and press Enter/Return.

Note: When linking to an external site, you must include the http:// at the beginning of the URL. If you omit it, the browser treats it as an internal link.

Preview the page

Design view gives you a reasonably good idea of what your page will look like on the web, but you must preview the page in Dreamweaver or in a browser to see the definitive end result. With Dreamweaver CS5, you can preview your page directly in the Document window using Live View. You can also compare how your site looks in leading browsers by launching BrowserLab.

Preview your page in Live View

To preview the page, ensure that the index.html page is open in the Document window, and click the Live View button (see Figure 23).

Click Live View to preview the page inside Dreamweaver.

Figure 23. Click Live View to preview the page inside Dreamweaver.

Dreamweaver displays a preview of your page, just as it would appear in a browser. The page does not look all that different, as Dreamweaver does a pretty good job of displaying pages in Design view as they would look in a browser; but you’ll notice that small changes occur when you enter Live view—the outlines for all of the div tags disappear, for example.

Dreamweaver Live View uses WebKit as its rendering engine—the same engine that powers the Apple Safari browser, and a host of other applications such as Google Chrome and Adobe AIR.

Check links in Live View

In Dreamweaver CS5, Live View works just like a real browser, allowing you to follow links. Hold down the Ctrl key (Windows) or Cmd key (Mac OS X) when you click a link, and Dreamweaver takes you to the target page within the Document window—even if the link points to an external page on a different site (assuming you’re connected to the internet at the time).

  1. Click the Live View button to view index.html as it looks in a standards-compliant browser.
  2. Hold down Ctrl/Cmd and click one of the “read more” links.The news.html page appears in the Document window (see Figure 24).

You can follow links to other pages in Live View in Dreamweaver CS5.

Figure 24. You can follow links to other pages in Live View in Dreamweaver CS5.

Notice that there’s a Browser Navigation bar at the top of the Document window. It works in the same way as you would expect in a browser with Backward and Forward buttons. The Home button takes you back to the page you started from. You can even type a completely different URL in the Address text box, and Dreamweaver loads it into Live View (as long as the site is accessible).

If you don’t want to hold down Ctrl/Cmd each time you click a link, select Follow Links Continuously from the Live View Options menu (see Figure 25).

Select the option to follow links continuously.

Figure 25. Select the option to follow links continuously.

However, this works only during the current Live View session. If you turn off Live View, you need to select this option again the next time you launch Live View.

  1. Click the Home icon in the Browser Navigation bar to return to index.html, and click Live View to turn it off.

Preview your page in BrowserLab

BrowserLab is an online Adobe service integrated directly into Dreamweaver CS5 that lets you see what your pages look like in a wide range of popular browsers on both Windows and Mac OS X, saving you the need to install multiple browsers and operating systems locally.

To use BrowserLab, you need an Adobe ID. If you registered your Adobe ID during the installation of Dreamweaver CS5 (or Creative Suite CS5), you’re ready to go. Otherwise, select Help > Register, and follow the instructions onscreen to register for CS Live Services.

  1. With index.html open in the Document window, open the BrowserLab panel by clicking its tab, or by selecting Window > BrowserLab. Make sure you’re connected to the internet, and that the menu option alongside the Preview button in the BrowserLab panel is set to Local, and click Preview.Alternatively, press Ctrl+Shift+F12 (Windows) or Shift+Cmd+F12 (Mac OS X).
  2. Dreamweaver opens BrowserLab in your default browser, and prompts you to sign in with your Adobe ID. It then uploads your page and all related files and assets to the BrowserLab server.After a short while (the time depends on the speed of your Internet connection), BrowserLab displays your page as it looks in a range of different browsers and operating systems. You can create your own subsets of browsers and operating systems to test in, view different ones side by side, or superimpose them in “onion skin” mode.Figure 26 shows index.html as it currently looks in Safari 4.0 on Mac OS X and Internet Explorer 6 on Windows XP.

Comparing the Check Magazine page in different browsers in BrowserLab.

Figure 26. Comparing the Check Magazine page in different browsers in BrowserLab.

If you look closely at the image on the right of Figure 26, you can see that Internet Explorer 6 leaves no gap between the main image and the image in the columns (Internet Explorer 7 does the same).

Note: When checking the page in BrowserLab, you’ll notice that the main image is not rendered in Firefox 2.0 on either Windows or Mac, because it’s a background image. The market share of Firefox 2.0 is estimated at about 0.6 percent and falling, so it can be ignored, particularly since the image is purely decorative.

  1. Switch back to Dreamweaver, and add the following style rule at the bottom of the check_cs5.css style sheet:

p { margin-top: 1em; }

This adds a margin of one em to the top of each paragraph. An em is a measurement borrowed from typography. In CSS, one em is equivalent to the height of the current font. When typing the rule, make sure there is no gap between the number and the unit. Type 1em, not 1 em.

  1. Save check_cs5.css, and click the Preview button in the BrowserLab panel to refresh the version on BrowserLab.
  2. Select Internet Explorer 6 in BrowserLab. The images at the top of the columns are now correctly positioned (see Figure 27).

BrowserLab confirms that the paragraph style has fixed the problem.

Figure 27. BrowserLab confirms that the paragraph style has fixed the problem.

  1. Select Internet Explorer 7. The images are correctly positioned.
  2. Check the other browsers. The images are now in the same position in all of them. By default, most browsers add a top margin equal to the height of one line at the top of every paragraph. It’s just Internet Explorer 6 and 7 that weren’t playing ball. The style rule brought them back into line without affecting the look in other, more standards-compliant browsers.
  3. Close your browser window or tab to exit BrowserLab.

Preview your page in a browser

Using BrowserLab to compare how your pages look in different browsers on different operating systems is important before you publish them on the Internet. But sometimes, you just want to take a quick look in a browser or two on your local computer. That’s where Preview in Browser comes in useful.

To preview the current page in your default browser, just press the F12 key (Windows) or Option+F12 (Mac OS X). You can also edit Dreamweaver Preferences to register other browsers.

  1. Select Edit > Preferences (Windows) or Dreamweaver > Preferences (Mac OS X) to open the Preferences panel.
  2. Select Preview in Browser from the Category list on the left.
  3. Dreamweaver might already have detected other browsers on your computer. To add other browsers, click the plus button alongside Browsers to open the Add Browser dialog box.
  4. Type the name of the browser in the Name text box, and click the Browse button to navigate to the browser’s application file.
    • On Windows, this is normally the .exe file in the browser’s subfolder of C:\Program Files or C:\Program Files(x86).
    • On Mac OS X, select the browser’s name in the Applications folder.

    Tip: On Windows, Google Chrome is installed in a folder associated with your user account. To locate it, you need to enable the display of hidden files and folders. Right-click the application name in the Windows Start menu and select Properties to find the exact location.

  5. Select one of the browsers listed in the Browsers text area, and select the Secondary browser check box. To launch the current page in the Document window in your secondary browser, press Ctrl+F12 (Windows) or Shift+Opt+F12 (Mac OS X).
  6. To launch your page in a particular browser, select File > Preview in Browser, and choose the browser from the list. Alternatively, click the Preview/Debug in Browser button on the Document toolbar, and select a browser from the list (see Figure 28).

Select a browser from the list to preview your page locally.

Figure 28. Select a browser from the list to preview your page locally.

Note: For more information about working with Live View, see Previewing pages in Dreamweaver in Dreamweaver Help. For more information about previewing in browsers, see Previewing pages in browsers in Dreamweaver Help.

Your page is almost finished and ready for publication. In Part 4: Adding the main image text, you’ll add another div to the main image area and position it using CSS.