- Dreamweaver User Guide
- Introduction
- Dreamweaver and Creative Cloud
- Dreamweaver workspaces and views
- Set up sites
- About Dreamweaver sites
- Set up a local version of your site
- Connect to a publishing server
- Set up a testing server
- Import and export Dreamweaver site settings
- Bring existing websites from a remote server to your local site root
- Accessibility features in Dreamweaver
- Advanced settings
- Set site preferences for transferring files
- Specify proxy server settings in Dreamweaver
- Synchronize Dreamweaver settings with Creative Cloud
- Using Git in Dreamweaver
- Manage files
- Create and open files
- Manage files and folders
- Getting and putting files to and from your server
- Check in and check out files
- Synchronize files
- Compare files for differences
- Cloak files and folders in your Dreamweaver site
- Enable Design Notes for Dreamweaver sites
- Preventing potential Gatekeeper exploit
- Layout and design
- CSS
- Understand Cascading Style Sheets
- Laying out pages using CSS Designer
- Using CSS preprocessors in Dreamweaver
- How to set CSS Style preferences in Dreamweaver
- Move CSS rules in Dreamweaver
- Convert inline CSS to a CSS rule in Dreamweaver
- Work with div tags
- Apply gradients to background
- Create and edit CSS3 transition effects in Dreamweaver
- Format code
- Page content and assets
- Set page properties
- Set CSS heading properties and CSS link properties
- Work with text
- Find and replace text, tags, and attributes
- DOM panel
- Edit in Live View
- Encoding documents in Dreamweaver
- Select and view elements in the Document window
- Set text properties in the Property inspector
- Spell check a web page
- Using horizontal rules in Dreamweaver
- Add and modify font combinations in Dreamweaver
- Work with assets
- Insert and update dates in Dreamweaver
- Create and manage favorite assets in Dreamweaver
- Insert and edit images in Dreamweaver
- Add media objects
- Adding videos in Dreamweaver
- Insert HTML5 video
- Insert SWF files
- Add audio effects
- Insert HTML5 audio in Dreamweaver
- Work with library items
- Using Arabic and Hebrew text in Dreamweaver
- Linking and navigation
- jQuery widgets and effects
- Coding websites
- About coding in Dreamweaver
- Coding environment in Dreamweaver
- Set coding preferences
- Customize code coloring
- Write and edit code
- Code hinting and code completion
- Collapse and expand code
- Reuse code with snippets
- Lint code
- Optimize code
- Edit code in Design view
- Work with head content for pages
- Insert server-side includes in Dreamweaver
- Using tag libraries in Dreamweaver
- Importing custom tags into Dreamweaver
- Use JavaScript behaviors (general instructions)
- Apply built-in JavaScript behaviors
- About XML and XSLT
- Perform server-side XSL transformations in Dreamweaver
- Performing client-side XSL transformations in Dreamweaver
- Add character entities for XSLT in Dreamweaver
- Format code
- Cross-product workflows
- Installing and using extensions to Dreamweaver
- In-App updates in Dreamweaver
- Insert Microsoft Office documents in Dreamweaver (Windows only)
- Working with Fireworks and Dreamweaver
- Edit content in Dreamweaver sites using Contribute
- Dreamweaver-Business Catalyst integration
- Create personalized email campaigns
- Templates
- About Dreamweaver templates
- Recognizing templates and template-based documents
- Create a Dreamweaver template
- Create editable regions in templates
- Create repeating regions and tables in Dreamweaver
- Use optional regions in templates
- Define editable tag attributes in Dreamweaver
- How to create nested templates in Dreamweaver
- Edit, update, and delete templates
- Export and import xml content in Dreamweaver
- Apply or remove a template from an existing document
- Edit content in Dreamweaver templates
- Syntax rules for template tags in Dreamweaver
- Set highlighting preferences for template regions
- Benefits of using templates in Dreamweaver
- Mobile and multiscreen
- Dynamic sites, pages and web forms
- Understand web applications
- Set up your computer for application development
- Troubleshoot database connections
- Removing connection scripts in Dreamweaver
- Design dynamic pages
- Dynamic content sources overview
- Define sources of dynamic content
- Add dynamic content to pages
- Changing dynamic content in Dreamweaver
- Display database records
- Provide and troubleshoot live data in Dreamweaver
- Add custom server behaviors in Dreamweaver
- Building forms using Dreamweaver
- Use forms to collect information from users
- Create and enable ColdFusion forms in Dreamweaver
- Create web forms
- Enhanced HTML5 support for form elements
- Develop a form using Dreamweaver
- Building applications visually
- Build master and detail pages in Dreamweaver
- Build search and results pages
- Build a record insert page
- Build an update record page in Dreamweaver
- Building record delete pages in Dreamweaver
- Use ASP commands to modify database in Dreamweaver
- Build a registration page
- Build a login page
- Build a page that only authorized users can access
- Securing folders in Coldfusion using Dreamweaver
- Using ColdFusion components in Dreamweaver
- Test, preview, and publish websites
- Troubleshooting
Use this topic to learn the basic concepts of CSS such as CSS rules, selectors, inheritance, and more. Also, learn how to associate CSS with your web pages in Dreamweaver.
About Cascading Style Sheets
Cascading Style Sheets (CSS) is a collection of formatting rules that control the appearance of content in a web page. Using CSS styles to format a page separates content from presentation. The content of your page—the HTML code—resides in the HTML file, and the CSS rules defining the presentation of the code reside in another file (an external style sheet) or in another part of the HTML document (usually the head section). Separating content from presentation makes it much easier to maintain the appearance of your site from a central location because you don’t need to update every property on every page whenever you want to make a change. Separating content from presentation also results in simpler and cleaner HTML code, which provides shorter browser loading times, and simplifies navigation for people with accessibility issues (for example, those using screen readers).
CSS gives you great flexibility and control over the exact appearance of your page. With CSS you can control many text properties including specific fonts and font sizes; bold, italics, underlining, and text shadows; text color and background color; link color and link underlining; and much more. By using CSS to control your fonts, you can also ensure a more consistent treatment of your page layout and appearance in multiple browsers.
In addition to text formatting, you can use CSS to control the format and positioning of block-level elements in a web page. A block-level element is a standalone piece of content, usually separated by a new line in the HTML, and visually formatted as a block. For example, h1 tags, p tags, and div tags all produce block-level elements on a web page. You can set margins and borders for block-level elements, position them in a specific location, add background color to them, float text around them, and so on. Manipulating block-level elements is in essence the way you lay out pages with CSS.
About CSS rules
A CSS formatting rule consists of two parts—the selector and the declaration (or in most cases, a block of declarations). The selector is a term (such as p, h1,a class name, or an id) that identifies the formatted element, and the declaration block defines what the style properties are. In the following example, h1 is the selector, and everything that falls between the braces ({}) is the declaration block:
h1 { font-size: 16 pixels; font-family: Helvetica; font-weight:bold; }
An individual declaration consists of two parts, the property (such as font-family) and value (such as Helvetica). In the previous CSS rule, a particular style has been created for h1 tags: the text for all h1 tags linked to this style will be 16 pixels in size, Helvetica font, and bold.
The style (which comes from a rule, or a collection of rules) resides in a place separate from the actual text it’s formatting—usually in an external style sheet, or in the head portion of an HTML document. Thus, one rule for h1 tags can apply to many tags at once (and in the case of external style sheets, the rule can apply to many tags at once on many different pages). In this way, CSS provides extremely easy update capability. When you update a CSS rule in one place, the formatting of all the elements that use the defined style are automatically updated to the new style.
You can define the following types of styles in Dreamweaver:
Class styles let you apply style properties to any element or elements on the page.
HTML tag styles redefine the formatting for a particular tag, such as h1. When you create or change a CSS style for the h1 tag, all text formatted with the h1 tag is immediately updated.
Advanced styles redefine the formatting for a particular combination of elements, or for other selector forms as allowed by CSS (for example, the selector td h2 applies whenever an h2 header appears inside a table cell.) Advanced styles can also redefine the formatting for tags that contain a specific id attribute (for example, the styles defined by #myStyle apply to all tags that contain the attribute-value pair id="myStyle").
CSS rules can reside in the following locations:
External CSS style sheets
Collections of CSS rules stored in a separate, external CSS (.css) file (not an HTML file). This file is linked to one or more pages in a website using a link or an @import rule in the head section of a document.
Internal (or embedded) CSS style sheets
Collections of CSS rules included in a style tag in the head portion of an HTML document.
Inline styles
Defined within specific instances of tags throughout an HTML document. (Using Inline styles is not recommended.)
Dreamweaver recognizes styles defined in existing documents as long as they conform to CSS style guidelines. Dreamweaver also renders most applied styles directly in Design view. (Previewing the document in a browser window, however, gives you the most accurate “live” rendering of the page.) Some CSS styles are rendered differently in Microsoft Internet Explorer, Netscape, Opera, Apple Safari, or other browsers, and some are not currently supported by any browser.
About cascading styles
The term cascading refers to the way a browser ultimately displays styles for specific elements on a web page. Three different sources are responsible for the styles you see on a web page: the style sheet created by the author of the page, the user’s customized style selections (if any), and the default styles of the browser itself. The previous topics describe creating styles for a web page as the author of both the web page and the style sheet attached to that page. But browsers also have their own default style sheets that dictate the rendering of web pages, and in addition to that, users can customize their browsers by making selections that adjust the display of web pages. The final appearance of a web page is the result of the rules of all three of these sources coming together (or “cascading”) to render the web page in an optimal way.
A common tag—the paragraph tag, or <p> tag—illustrates the concept. By default, browsers come with style sheets that define the font and font size for paragraph text (that is, text that falls between <p> tags in the HTML code). In Internet Explorer, for example, all body text, including paragraph text, displays in Times New Roman, Medium font by default.
As the author of a web page, however, you can create a style sheet that overrides the browser’s default style for paragraph font and font size. For example, you can create the following rule in your style sheet:
p { font-family: Arial; font-size: small; }
When a user loads the page, the paragraph font and font size settings set by you as the author override the default paragraph text settings of the browser.
Users can make selections to customize the browser display in an optimal way for their own use. In Internet Explorer, for example, the user can select View > Text Size > Largest to expand the page font to a more readable size if they think the font is too small. Ultimately (at least in this case), the user’s selection overrides both the default browser styles for paragraph font size and the paragraph styles created by the author of the web page.
Inheritance is another important part of the cascade. Properties for most elements on a web page are inherited—for example, paragraph tags inherit certain properties from body tags, span tags inherit certain properties from paragraph tags, and so on. Thus, if you create the following rule in your style sheet:
body { font-family: Arial; font-style: italic; }
All paragraph text on your web page (as well as text that inherits properties from the paragraph tag) will be Arial and italic because the paragraph tag inherits these properties from the body tag. You can, however, become more specific with your rules, and create styles that override the standard formula for inheritance. For example, if you create the following rules in your style sheet:
body { font-family: Arial; font-style: italic; } p { font-family: Courier; font-style: normal; }
All body text will be Arial and italic except paragraph (and its inherited) text, which will display as Courier normal (non-italic). Technically, the paragraph tag first inherits the properties that are set for the body tag, but then ignores those properties because it has properties of its own defined. In other words, while page elements generally inherit properties from above, the direct application of a property to a tag always causes an override of the standard formula for inheritance.
The combination of all of the factors discussed above, plus other factors like CSS specificity (a system that gives different weight to particular kinds of CSS rules), and the order of CSS rules, ultimately create a complex cascade where items with higher priorities override properties that have lower priorities. For more information on the rules governing the cascade, inheritance, and specificity, visit www.w3.org/TR/CSS2/cascade.html.
About text formatting and CSS
By default, Dreamweaver uses Cascading Style Sheets (CSS) to format text. The styles that you apply to text using the Property inspector or menu commands create CSS rules that are embedded in the head of the current document.
You can also use the CSS Designer to create and edit CSS rules and properties. The CSS Designer is a much more robust editor than the Property inspector, and displays all CSS rules defined for the current document, whether those rules are embedded in the head of the document or in an external style sheet. Adobe recommends that you use the CSS Designer (rather than the Property inspector) as the primary tool for creating and editing your CSS. As a result, your code will be cleaner and easier to maintain.
For more information on CSS Designer, see Laying out pages using CSS Designer.
In addition to styles and style sheets you create, you can use style sheets that come with Dreamweaver to apply styles to your documents.
For a tutorial about formatting text with CSS, see www.adobe.com/go/vid0153.
About Shorthand CSS properties
The CSS specification allows for the creation of styles using an abbreviated syntax known as shorthand CSS. Shorthand CSS lets you specify the values of several properties using a single declaration. For example, the font property lets you set font-style, font-variant, font-weight, font-size, line-height, and font-family properties on a single line.
A key issue to note when using shorthand CSS, is that values omitted from a shorthand CSS property are assigned their default value. This may cause pages to be incorrectly displayed when two or more CSS rules are assigned to the same tag.
For example, the h1 rule shown below uses longhand CSS syntax. Note that the font-variant, font-stretch, font-size-adjust, and font-style properties have been assigned their default values.
h1 { font-weight: bold; font-size: 16pt; line-height: 18pt; font-family: Arial; font-variant: normal; font-style: normal; font-stretch: normal; font-size-adjust: none }
Rewritten as a single, shorthand property, the same rule might appear as follows:
h1 { font: bold 16pt/18pt Arial }
When written using shorthand notation, omitted values are automatically assigned their default values. Thus, the previous shorthand example omits the font-variant, font-style, font-stretch, and font-size-adjust tags.
If you have styles defined in more than one location (for example, both embedded in an HTML page and imported from an external style sheet) using both the short and long forms of CSS syntax, be aware that omitted properties in a shorthand rule may override (or cascade) properties that are explicitly set in another rule.
For this reason, Dreamweaver uses the long form of CSS notation by default. This prevents possible problems caused by a shorthand rule overriding a longhand rule. If you open a web page that was coded with shorthand CSS notation in Dreamweaver, be aware that Dreamweaver will create any new CSS rules using the longhand form. You can specify how Dreamweaver creates and edits CSS rules by changing the CSS editing preferences in the CSS Styles category of the Preferences dialog box (Edit > Preferences in Windows; Dreamweaver > Preferences on the Macintosh).
Dreamweaver and CSS
In Dreamweaver, you can work with CSS in multiple ways:
- You can use the CSS Designer to build your CSS with minimal coding. For more information, see Laying out pages using CSS Designer.
- You can also code your CSS by hand. For more information on coding features offered by Dreamweaver, see Coding environment in Dreamweaver.
- If you prefer to work with Sass, Scss, or Less files, you can code your files using your preferred syntax and use it in Dreamweaver. For more information, see CSS preprocessors.