Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Dreamweaver what skills must be mastered in writing CSS

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you what skills Dreamweaver must master to write CSS, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Generally speaking, a style sheet (style sheet) is a collection of formatting rules that control the appearance of web content. You can use CSS in your page in three different ways:

Inline: an one-time style written to the code.

Embedded: a stylesheet that controls all elements in a page

External: a style sheet that controls elements in many pages

In fact, many sites combine these three approaches as needed.

An important fact to consider when using CSS is that different browsers and different versions of the same browser parse CSS in different ways. In addition to the differences in web browsers, you should also be aware of many other browsers, such as listening browsers, TV-based browsers, and handheld devices such as Palm pilot and TTY (teletypewriter, remote typewriter).

What is the best habit?

Most technologies have their own established standards. CSS is no exception. Although not all CSS that exists on the network is standard, it is beneficial to use CSS according to existing standards. In general, developers should separate content from reports as much as possible. The benefits of this are:

1: increase the life of the site

Irregular stylesheets may have been convenient at the time, but compatibility problems are likely to occur when the new version of the browser comes out. Then modifying the site page by page is a very time-consuming task and makes it meaningless to use CSS.

2: make your site applicable to all users and browsers.

In some places, governments have enacted legislation requiring websites to be accessible to people with disabilities. Browsing devices designed for disability awareness, such as listening browsers, are extremely strict with CSS norms.

3: make site updates and maintenance easier.

If used properly, CSS allows your adjustments in one page to be quickly applied to all pages.

The first choice you have to make is which stylesheet to use. When it comes to best practices, the analysis of different stylesheets is as follows:

Inline CSS; simply says that you should avoid using it as much as possible. Among other disadvantages, using Inline CSS means that you don't take advantage of the real advantages of CSS, that is, you don't separate content from format. DW MX uses Inline CSS primarily to locate page elements (which are called "layers" in DW MX's user interface), or to use some DHTML special effect, it needs to use the Inline-style & # 106avascript to change the properties of an object.

Embedded CSS: it's not ideal either, because it can only influence the current page. In the process of updating, if a page is lost, the style of the site will be inconsistent; in addition, when users browse your site, each page will have to download stylesheet information.

External CSS: this is your first choice. External CSS allows all pages connected to it to maintain a consistent look and feel; outline, change once, easily update all related pages; make your pages smaller and faster. Some of the other best practices will be mentioned in the following analysis of specific CSS features.

Create a CSS style sheet in DW MX

When you create a CSS stylesheet in DW MX (Text "CSS Style" New style sheet), in the pop-up dialog box, you have two choices: the new stylesheet document (New Style Sheet File) and for the current page only (This Document Only). Select "New Style Sheet File" and you begin the process of creating an External CSS. This option requires you to name the stylesheet and select a save location for it before the actual creation process; another option, This Document Only, will write the relevant code directly to the section of the page.

You can also select an existing stylesheet in the New style dialog box to edit or add a new definition.

Should I connect to External CSS or import?

After you create an external stylesheet, you need to attach it to each page (or template). To do this, you can add a style sheet (Attach Style Sheet) button in the off-season on the CSS panel, and the Link External Style Sheet dialog box will pop up, where you can browse to the name of your target style sheet, and after finding it, you can choose to connect (link) or import (import) the external style sheet.

Join is the most common way, select "link" to connect the style sheet to the page. It will add the following tag to your page:

All browsers that support CSS support the connection option. If you want some older browsers (such as Netscape 4.x) to "see" this stylesheet, you should use the following method.

If you select the Import option, the tag used is:

NetSscape4 completely ignores the imported CSS and interprets the page according to the connected CSS. In this way, we can safely use the new features in CSS without having to worry about browser compatibility.

CSS property inspector

You can easily switch to CSS mode in the DW MX property inspector. By default, the property inspector displays the original font tags in HTML mode. Click the small "A" next to the font drop-down menu and you can see the currently available CSS stylesheets instead of a list of font tags.

At the same time, you can easily switch back to HTML mode.

Ready-made CSS stylesheet

One of the exciting CSS features in DW MX is that it contains CSS stylesheets that have been made. New users of CSS can try it first. Select File > New, select CSS style sheets in the pop-up new document dialog box, and a list of all available CSS will appear in the box on the right. To practice what we call best habits, choose one labeled "Accessible".

Save the document in the site folder, and then you can use the above method to attach CSS to your document.

Design time style sheet (Design Time style sheets)

This feature of DW MX allows you to apply stylesheets to the page when working in design view, giving you a more intuitive understanding of the appearance of the site. The design time stylesheet will not appear within the site. This feature is very useful from the point of view of our best habits. If you use both import and connection (as described above), attaching a design-time stylesheet allows you to use either of them to develop your site. When you want to see what the page looks like under another style sheet, you can easily change it to another style sheet.

Designing time stylesheets is also useful for developers who want to apply CSS on the server side (such as ASP, PHP, or ColdFusion) or access it on the client side via & # 106avascript. Server-side stylesheets are also another way to deal with client browsers' poor support for CSS. However, in previous versions of DW, this approach did not allow you to see the actual effect of CSS at design time. Designing a time stylesheet allows you to view the effects of the stylesheet in real time, so you can work in a visual interface in DW MX. Another benefit is that when you upload site files, you no longer have to check the entire site for redundant stylesheets.

Validate

Whether you are creating your own stylesheet or editing an existing stylesheet, validation ensures that you do not misuse non-standard tags or incorrect code. DW MX itself does not include a CSS validator, you can use the verification service provided by the W3C site. Within DW MX you can verify HTML or DHTML tags (File > Check Page > Validate Markup or File > Check Page > Validate as XML for XHTML.). DW MX provides a number of aids when developing CSS-based sites. With the help of MW MX and a good understanding of CSS, you can develop sites that stand the test of time.

The above is all the contents of this article entitled "what skills Dreamweaver must master in writing CSS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report