![]() |
|
|
|
|
|
- HTML-Editor: (X)HTML-Format - Tutorials (editor realted) - Webmaster Tool: WebAnalysis
- News
|
Tutorial 3: CSS, Code-Snippets and Other Functions for Advanced Users.You will learn here
Prerequisites
If one ore more of the prerequisites are not fulfilled, you should first work through Tutorial 1: First Steps. Which Other Tutorials Exist ?There is currently an ongoing process in expanding the tutorials offering. Actually there are available the following tutorials for HTML-Editor (X)HTML-Format:
Creation of CSS Definitions Exploiting the CSS Generator.CSS (Cascading Style Sheets) is a feature, that allows you to format your HTML pages according to your own desires.
CSS allows to define your own style sheets that are used to format your text.
You now will learn, how to generate a CSS definition named "cssexample". This definition will format the text as follows:
Please open now the central CSS definition file of your project. It is called styles.css if you use the default settings of (X)HTML-Format
and should be located in the project, you generated in tutorial 1.
The CSS generator dialog opens. It supports you in the generation of CSS classes (style sheets).
Hint:
To modify an existing style sheet (e.g. the Bold-tag) <b></b> you could just enter "b" here (without the double quotes). The formatting you define, is valid for this tag. Enter now two alternative fonts. You should select them in such a manner, the your preferred font comes first, and the alternative fonts follow.
This rank order should guarantee, that your web site looks good even under operating systems, in which your preferred font is not provided.
The browser selects in this case the alternative fonts in the order, they are specified.
Hint:
Of course you can set much more parameters. But this would be too much details for a tutorial and make the whole session boring, because the setting of each parameter follows the same scheme. Just have a look at the selection lists for size, alignment, and decoration and play a little with the offered formatting parameters.
The text formatting is done. But we still have to do the borders and margins.
To set these parameters, select the tab with the "Borders/Margins" label.
Now mark "Borders" and "Margins" and then for "Margins" also set checkmark "common" to marked.
For the margins "common" has been selected. Therefore you provide here only a single value one for "margin" and one for "padding". Specify here the value 5 px (pixels).
Hint:
>As units you can select between many different values. Pixels is a relative measurement, because a pixel has no defined width and height for presenation devices. Therefore absolute measurements like mm (millimeter) guarantee identical size on different presentation media. Now klick the "OK" button. The source code for the SCC style sheet is now generated and presented in the editor pane. It should look like this:
.cssexample {
color: #000099; font-family: Verdana, Arial; font-weight: bold; font-size: 105%; border-left:1px dotted #cc00cc; border-right:1px dotted #cc00cc; border-bottom:1px solid #cc00cc; border-top:1px solid #cc00cc; margin:5px; padding:5px; }
Usage of CSS Classes in HTML-Documents.Store (save) your CSS file and create a new HTML document. You will recognize, that the CSS file automatically is incorporated into your document. This is because the project properties state, where the central CSS file can be found. Now enter the following text into the body of your HTML document:
<h3>Example for a Div-Tag (explanation follows):</h3>
Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. <div class="cssexample">With the CSS definition formatted text segment.</div> Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. <p>
You now have assigned the CSS class to a Div-tag and to a Span-tag.
The result should look like:Example with Div-Tag:Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment.With the CSS definition formatted text segment.
Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment.
Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment.
Example with Span-TagUnformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. With the CSS definition formatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment. Unformatted text segment.
Annotatin:
You see, that the Div tag generates an isolated rectangular area (probably multi line) for the text, whereas the Span tag inserts the text into a stream of continuous text. You see also, that the borders and margins for frames in continuous text are not very usefull, because the frame may override surrounding text. Using Code-Snippets.What are Code-Snippets?One of the most powerful features of (X)HTML-Format 8 are so called code snippets.
This may explained using an example.
The control character "|" specifies, that at it's position the previously selected text shall be inserted, replacing this control character. If you did not mark a text segment, this control character determines the position of the curser. But code snippets allow even more.
<SCRIPT LANGUAGE="Javascript">
<!-- if (top==self) { location.href="|filename.htm|" } //--> </SCRIPT> You see, that there are "|" control characters surrounding the file specification. This causes, that this code snippet selects the the file specification after insertion. If you now enter something via the keyboard, the selected text will be replaced by your input. Creating New Code Snippets.
Please open code snippet set "Standard" via menu "Code Snippets->Snippet Sets"
<div class="seperator_dark">|Heading|</div>
Now save the code snippetwith a click on butten "Save content". Congratulation, you have generated your first code snippet. Do the same for the following coed snippets.
Leave the dialog after you have saved the last snippet via button "Close". If you now open menu "Code Snippets" you see your three new code snippets as menu items.
Remark:
Test now your code snippets. First try code snippet "div-seperator":
The code snippet set is not yet saved to the hard disk. This will be done automatically, when you leave the HTML-Format program or when you switch to another code snippet. To save the codecsnippet immediately, go via menu "Code Snippets->snippet sets" to a different snippet set and then back to your current one. Annotation:
You will see, that the headline is marked after insertion. Now try "div-miniborder":
Generate your own Code-Snippet Set.To group your code snippets you need to generate an own code snippet set. This is also done with the code snippet dialog. Just click at button "New Set" and provide the name of the new set. Then do the same as you did in the previous example. Conclusion:
Customization and Optimization of Editor Tags.(X)HTML-Format offers a lot of functions. Most of them are used to generate (X)HTML tags, which may have a relatively complex syntax as well as
many attributes.
You may ask yourself, why to modify existing tags?
Use this button, if you want to discard a modification you did in field "Actual content" to reestablish the original default value. To provide a footer for each newly created HTML document, find the tag named "new_dialog_htm" in the tag list.
<body bgcolor="%7" text="%8" link="%9" vlink="%10" alink="%11">
| </body> Now enter a blank line after control character "|" and modify the source text, so that it reads as follows:
<body bgcolor="%7" text="%8" link="%9" vlink="%10" alink="%11">
| <p> Document last changed:<br> <!--HTML-FORMAT:AUTO-TEXT-DATUM--><!--/--> at <!--HTML-FORMAT:AUTO-TEXT-ZEIT--><!--/--> </body> Now click on "Save content". Now open tag "new_quick_htm" and do the same. The tag "new_quick_htm"
is the source text, which is inserted into a new file, when you click button: After saving your modifications close the tag dialog via button "Close". To see the result, just create a new HTML document.
Annotation: After having saved the file you also see, what this modification means.
At the position the comments have been shown, now the actual date and time is inserted.
Such auto-text you may also insert via the buttons Coming Up ...Congratulations, you have finished this tutorial successfully. You'r now very familiar with the various functions of (X)HTML-Format 8.
The tutorials did not cover every feature of the tool, but I asume, that you'r now in a position to learn the functions not covered
by your own easily.
Best regards All rights on this tutarial belong to Christian Diekmann. You may reuse and distribute it only with written permission of the author. |
||||||