490 likes | 617 Views
Tutorial 6 Creating Dynamic Pages. Objectives. Understanding CSS page layout techniques Insert divs into a Web page Select, resize, and move a div Add content to a div Adjust div stacking order Adjust div attributes. Objectives. Float the divs in a page Nest AP divs
E N D
Objectives • Understanding CSS page layout techniques • Insert divs into a Web page • Select, resize, and move a div • Add content to a div • Adjust div stacking order • Adjust div attributes Dreamweaver CS3 Tutorial 6
Objectives • Float the divs in a page • Nest AP divs • Add behaviors to a page • Create an e-mail link • Edit and delete behaviors Dreamweaver CS3 Tutorial 6
Laying Out Pages with CSS • CSS page layout is the current standard for laying out professional Web pages. • div tag creates a transparent container you place in a Web page to hold content. • Dreamweaver provides prebuilt CSS layout pages Dreamweaver CS3 Tutorial 6
Laying Out Pages with CSS Dreamweaver CS3 Tutorial 6
Laying Out Pages with CSS • You can create a CSS page layout on your own. • Insert divs into a page • Create CSS styles to format the divs • Place the content into the div • Spend time planning the pages of your site before you begin creating a CSS layout. Dreamweaver CS3 Tutorial 6
Laying Out Pages with CSS Dreamweaver CS3 Tutorial 6
Laying Out Pages with CSS Dreamweaver CS3 Tutorial 6
Using Absolutely Positioned Div Tags • With absolute positioning (AP), div tags can be positioned anywhere on the screen with great accuracy and reliability. • AP divs can be stacked on top of one another so that their content overlaps. • You draw an AP div in a page in Design view. Dreamweaver CS3 Tutorial 6
Using Absolutely Positioned Div Tags Dreamweaver CS3 Tutorial 6
Selecting, Resizing, and Moving an AP Div • An AP div can be active or selected. • To make an AP div active, click in the AP div. • To select an AP div, click the edge of the AP div in the Document window when its border is visible (or click the selection handle when the AP div is active, or in the AP Elements panel, located in the CSS panel group, click the name of the AP div). Dreamweaver CS3 Tutorial 6
Selecting, Resizing, and Moving an AP Div • To resize an AP div, drag any resize handle until the AP div is the desired size (or enter exact height and width values in the Property inspector). • To move an AP div, drag the AP div by its selection handle to the desired location (or press the arrow keys to shift the selected AP div one pixel at a time to the desired location, or enter Left, Top, and z-index numbers in the Property inspector). Dreamweaver CS3 Tutorial 6
Selecting, Resizing, and Moving an AP Div Dreamweaver CS3 Tutorial 6
Selecting, Resizing, and Moving an AP Div Dreamweaver CS3 Tutorial 6
Adding Content to an AP Div • An AP div can contain almost any type of content, including text, graphics, forms, multimedia content, tables, and other divs. • Cannot contain frames, but can be placed within a frame Dreamweaver CS3 Tutorial 6
Adding Content to an AP Div Dreamweaver CS3 Tutorial 6
Adjusting AP Div Attributes • You can change the attributes of an AP div tag • CSS-P Element ID • L (Left) and T (Top) • W (Width) and H (Height) • Z-Index • Vis (Visibility) • Bg Image (Background Image) • Bg Color (Background Color) • Class • Overflow • Clip Dreamweaver CS3 Tutorial 6
Adjusting AP Div Attributes Dreamweaver CS3 Tutorial 6
Examining the Code for AP Div Tags • An ID selector is a custom style class that is used only one time. • The ID selector style is used because AP div positioning is usually unique to that particular AP div. • It is sometimes useful to create external styles to define the AP div positioning. Dreamweaver CS3 Tutorial 6
Examining the Code for AP Div Tags Dreamweaver CS3 Tutorial 6
Examining the Code for AP Div Tags Dreamweaver CS3 Tutorial 6
Modifying AP Divs • AP divs in a Web page can be stacked or overlapped. • Each new AP div you create is assigned the next consecutive z-index number. • On the screen, AP divs with higher z-index numbers appear in front of those with lower z-index numbers. Dreamweaver CS3 Tutorial 6
Modifying AP Divs Dreamweaver CS3 Tutorial 6
Modifying AP Divs Dreamweaver CS3 Tutorial 6
Aligning AP Divs • You can drag AP divs on the page to reposition them. • You may also wish to align elements for a neater look. • To align layers: • Hold the Shift key down and select the layers. • Click Modify on the menu bar, point to Arrange, and then click an Align command. Dreamweaver CS3 Tutorial 6
Aligning AP Divs Dreamweaver CS3 Tutorial 6
Positioning Elements Using the Grid • You can also realign layers using the grid. • The grid is a series of parallel horizontal and vertical lines that overlap to create equal-sized squares in the background of the Document window. • The grid is hidden by default, but can be displayed. • You can adjust the grid’s size or appearance in the Grid Settings dialog box. Dreamweaver CS3 Tutorial 6
Positioning Elements Using the Grid Dreamweaver CS3 Tutorial 6
Creating Nested AP Divs • Nested AP divs work like nested tables and frames, except that nested AP divs do not have to be physically positioned within each other. • Nesting AP divs refers to the underlying code. • To nest AP divs, you use the AP Elements panel • Press and hold the Ctrl key and then drag the AP div to be nested over the parent AP div. • The nested AP div will be indented under the parent AP div in the AP Elements panel. • The reverse action will un-nest the AP divs. Dreamweaver CS3 Tutorial 6
Creating Nested AP Divs Dreamweaver CS3 Tutorial 6
Creating Nested AP Divs Dreamweaver CS3 Tutorial 6
Understanding Behaviors • A behavior is code added to a Web page that allows users to interact with various elements in the Web page. • A behavior is like an equation: • object + event = action • Object is the element on the Web page that the behavior is attached to. Dreamweaver CS3 Tutorial 6
Understanding Behaviors • Event is what takes place and has two parts: • User event (trigger action) • Event handler (code used to refer to the event) • Action is what happens when the event is performed on the object. Dreamweaver CS3 Tutorial 6
Understanding Behaviors Dreamweaver CS3 Tutorial 6
Understanding Behaviors • The easiest way to insert behaviors into your pages is to use a preset behavior tool. • You have already used several of these tools, i.e. Rollover buttons and the Navigation Bar button. • You can see the behaviors that Dreamweaver has created for you by selecting an object and opening the Behaviors panel. • You can also use the Behaviors panel to create customized behaviors. Dreamweaver CS3 Tutorial 6
Understanding Behaviors • When using the Behaviors panel to create behaviors, you select an object, and then a prelisted action/event handler. • Dreamweaver will combine them and create the code to create the behavior. • You can also create your own custom behaviors by writing your own code. Dreamweaver CS3 Tutorial 6
Understanding Behaviors • To add a behavior from the Behaviors panel, you make several choices: • Object – first you choose the object on the page. • Target browser – then you choose the browser brand and version to be compatible with. • Action – you will then choose from within actions that are compatible with the chosen browser. • Event – Dreamweaver then displays a list of possible events for you to chose from. Dreamweaver CS3 Tutorial 6
Understanding Behaviors Dreamweaver CS3 Tutorial 6
Understanding Behaviors Dreamweaver CS3 Tutorial 6
Understanding Behaviors Dreamweaver CS3 Tutorial 6
Understanding Behaviors Dreamweaver CS3 Tutorial 6
Understanding Behaviors Dreamweaver CS3 Tutorial 6
Understanding Behaviors Dreamweaver CS3 Tutorial 6
Adding an E-Mail Link to a Page • A user can click an e-mail link to start his or her default e-mail program, and open a blank message window with the e-mail address specified in the e-mail link already entered in the To field. • To create an e-mail link, type “mailto:” and your e-mail address in the Link text box in the Property inspector. Dreamweaver CS3 Tutorial 6
Adding a Custom Script to a Page • You can add a custom script written by another programmer to a Web page. • If you know JavaScript, you can write your own scripts. Dreamweaver CS3 Tutorial 6
Adding a Custom Script to a Page Dreamweaver CS3 Tutorial 6
Editing and Deleting Behaviors • Once a behavior has been created, you can change the event handler associated with the behavior. • You can also delete a behavior. • To change the action, you need to delete the old behavior, select the object, and then attach the new behavior. Dreamweaver CS3 Tutorial 6
Updating the Web Site on the Remote Server • To update: • Connect to the remote server using the Connects to Remote Host button on the Files panel toolbar • Click the View list arrow, and then click Local View • Select the updated files, and click the Put File(s) button • Click the Yes button when asked if you want to include dependent files • Disconnect using the Disconnects from Remote Host button • Click the View list arrow, and then click Local View Dreamweaver CS3 Tutorial 6
Tutorial Summary • Insert divs that use relative positioning • Draw AP divs in a Web page • Select, move, resize, and add content to AP divs • Adjust the AP divs’ attributes • Adjust stacking order • Align AP divs and create nested AP divs • Review HTML code involved with AP divs • Add, edit, and delete behaviors Dreamweaver CS3 Tutorial 6