User:Ayjayaredii/Wiki Help: Difference between revisions
Ayjayaredii (talk | contribs) m Updated |
Ayjayaredii (talk | contribs) Updated with CSS tables |
||
| Line 163: | Line 163: | ||
| <nowiki>Coolant: H<sub>2</sub>O</nowiki> | | <nowiki>Coolant: H<sub>2</sub>O</nowiki> | ||
| Coolant: H<sub>2</sub>O | | Coolant: H<sub>2</sub>O | ||
|- | |||
| '''<nowiki><ul></nowiki>''' | |||
| Defines an '''unordered (bulleted) list'''. | |||
|Used for grouping related items where order doesn't matter. | |||
| <nowiki><ul><li>Item 1</li><li>Item 2</li></ul></nowiki> | |||
| <ul><li>Item 1</li><li>Item 2</li></ul> | |||
|- | |||
| '''<nowiki><ol></nowiki>''' | |||
| Defines an '''ordered (numbered) list'''. | |||
| Used for grouping related items where the order or sequence is important. | |||
| <nowiki><ol><li>Step 1</li><li>Step 2</li></ol></nowiki> | |||
| <ol><li>Step 1</li><li>Step 2</li></ol> | |||
|- | |||
| '''<<nowiki><li></nowiki>''' | |||
| Defines an item within a '''list'''. | |||
| Must be used inside an <nowiki><ul></nowiki> or <nowiki><ol></nowiki> tag. | |||
| <nowiki><li>List item content</li></nowiki> | |||
| <ul><li>List item content</li></ul> | |||
|} | |||
</div> | |||
</div> | |||
{{clear}} | |||
== Styling with CSS == | |||
CSS (Cascading Style Sheets) is used to control the visual presentation of HTML elements, such as colors, fonts, spacing, and layout. In MediaWiki, CSS is most commonly applied using the `style` attribute directly within an HTML tag (inline styles). | |||
<div style="width: 100%; overflow: hidden;"> | |||
<div style="border: 2px solid black; padding: 10px; width: auto; border-radius:15px; text-align: center; font-size: 1em; margin: 0 auto; box-sizing: border-box;"> | |||
<h3> General Syntax </h3> | |||
<p>'''Inline Style Attribute:''' The `style` attribute is placed inside the opening tag of an HTML element (e.g., <code><nowiki><div style="color: blue;">Content</div></nowiki></code>). | |||
<br> Properties and values are separated by a colon (`:`), and multiple property-value pairs are separated by a semi-colon (`;`). | |||
<br> <div style="background-color: #ABCDEF; border: 2px solid black; padding: 10px; width: 50%; border-radius: 15px; margin: 0 auto; text-align: center;">This is a box with multiple styles applied. | |||
<hr><code><nowiki><div style="background-color: #ABCDEF; border: 2px solid black; padding: 10px; width: 50%; border-radius: 15px; margin: 0 auto; text-align: center;">This is a box with multiple styles applied.</div></nowiki></code></p> | |||
<div style="width: 50%; margin: 0 auto; text-align: left;"> | |||
</div></div> | |||
<ul style="list-style-position: inside; padding-left: 0; text-align: center"> | |||
<li><code>px</code> (pixels): An absolute unit, good for fixed sizes (e.g., `100px`).</li> | |||
<li><code>%</code> (percentage): Relative to the parent element's size (e.g., `50%` of parent's width).</li> | |||
<li><code>em</code>: Relative to the font size of the element (e.g., `1em` is current font size; `2em` is twice). This is good for scaling.</li> | |||
<li><code>rem</code>: Relative to the font size of the root HTML element.</li> | |||
<li><code>auto</code>: Browser automatically calculates values (e.g., used for `margin` to center block elements).</li> | |||
</ul> | |||
</div> | |||
</p> | |||
</div> | |||
</div> | |||
{{clear}} | |||
<div style="width: 100%; overflow: hidden;"> | |||
<div style="border: 2px solid black; padding: 10px; width: auto; border-radius:15px; text-align: center; font-size: 1em; margin: 0 auto; box-sizing: border-box;"> | |||
<h3> Common Text Styles </h3> | |||
<p>These properties control the appearance of text within an element.</p> | |||
{| class="wikitable" style="width:100%; margin-top:0.5em; margin-bottom:1em; text-align: left;" | |||
|- | |||
! Property !! Purpose !! Example Code !! Result | |||
|- | |||
| '''`color`''' | |||
| Sets the text color. | |||
| <code><nowiki>style="color: red;"</nowiki></code> | |||
| <span style="color: red;">Red Text</span> | |||
|- | |||
| '''`font-size`''' | |||
| Sets the size of the text. | |||
| <code><nowiki>style="font-size: 1.2em;"</nowiki></code> | |||
| <span style="font-size: 1.2em;">Larger Text</span> | |||
|- | |||
| '''`text-align`''' | |||
| Aligns inline content (text, images) horizontally within an element. | |||
| <code><nowiki>style="text-align: center;"</nowiki></code> | |||
| <div style="text-align: center;">Centered Text</div> | |||
|- | |||
| '''`font-weight`''' | |||
| Sets the boldness of the text. Common values are `bold` or numerical values like `700`. | |||
| <code><nowiki>style="font-weight: bold;"</nowiki></code> | |||
| <span style="font-weight: bold;">Bold Text</span> | |||
|} | |||
</div> | |||
</div> | |||
{{clear}} | |||
<div style="width: 100%; overflow: hidden;"> | |||
<div style="border: 2px solid black; padding: 10px; width: auto; border-radius:15px; text-align: center; font-size: 1em; margin: 0 auto; box-sizing: border-box;"> | |||
<h3> Common Box/Layout Styles </h3> | |||
<p>These properties control the appearance and positioning of block-level elements like `div`s.</p> | |||
{| class="wikitable" style="width:100%; margin-top:0.5em; margin-bottom:1em; text-align: left;" | |||
|- | |||
! Property !! Purpose !! Example Code !! Result | |||
|- | |||
| '''`background-color`''' | |||
| Sets the background color of the element. Can use color names (`blue`), hex codes (`#ABCDEF`), or RGB (`rgb(255,0,0)`). | |||
| <code><nowiki>style="background-color: #ABCDEF;"</nowiki></code> | |||
| <div style="background-color: #ABCDEF; padding: 5px;">Colored Background</div> | |||
|- | |||
| '''`border`''' | |||
| Sets all properties of an element's border (width, style, color) in one go. | |||
| <code><nowiki>style="border: 2px solid black;"</nowiki></code> | |||
| <div style="border: 2px solid black; padding: 5px;">Bordered Box</div> | |||
|- | |||
| '''`border-radius`''' | |||
| Rounds the corners of an element's border. | |||
| <code><nowiki>style="border-radius: 15px;"</nowiki></code> | |||
| <div style="border: 2px solid black; border-radius: 15px; padding: 5px;">Rounded Corners</div> | |||
|- | |||
| '''`padding`''' | |||
| Creates space *inside* an element, between its content and its border. | |||
| <code><nowiki>style="padding: 10px;"</nowiki></code> | |||
| <div style="border: 1px solid gray; padding: 10px;">Padded Content</div> | |||
|- | |||
| '''`width`''' | |||
| Sets the width of an element. | |||
| <code><nowiki>style="width: 50%;"</nowiki></code> | |||
| <div style="border: 1px solid gray; width: 50%; background-color: #f0f0f0;">Half-width Box</div> | |||
|- | |||
| '''`margin`''' | |||
| Creates space *outside* an element, between its border and other elements. Used with `auto` to center a block element with a defined width. | |||
| <code><nowiki>style="margin: 0 auto;"</nowiki></code> | |||
| <div style="border: 1px solid gray; width: 50%; margin: 0 auto; background-color: #f0f0f0;">Centered Box</div> | |||
|- | |||
| '''`float`''' | |||
| Positions an element to the left or right, allowing other content to wrap around it. | |||
| <code><nowiki>style="float: left;"</nowiki></code> | |||
| <div style="float: left; border: 1px solid gray; padding: 5px; margin-right: 10px; background-color: #f0f0f0;">Floated Left</div> This text wraps. | |||
|- | |||
| '''`clear`''' | |||
| Forces an element to move below (clear) any preceding floated elements. | |||
| <code><nowiki>style="clear: both;"</nowiki></code> | |||
| <div style="float: left; border: 1px solid gray; padding: 5px; margin-right: 10px; background-color: #f0f0f0;">Floated Left</div><div style="clear: both; border: 1px solid gray; padding: 5px; margin-top: 10px; background-color: #f0f0f0;">Cleared Below</div> | |||
|- | |||
| '''`display`''' | |||
| Specifies how an element is displayed (e.g., `block`, `inline`, `flex`). `flex` is powerful for complex layouts. | |||
| <code><nowiki>style="display: flex;"</nowiki></code> | |||
| <div style="border: 1px solid gray; padding: 5px; display: flex; justify-content: space-around; background-color: #f0f0f0;"><span>Item 1</span><span>Item 2</span></div> | |||
|- | |||
| '''`box-sizing`''' | |||
| Defines how an element's total width and height are calculated (whether padding and border are included in the specified `width`/`height`). `border-box` is often preferred for layout. | |||
| <code><nowiki>style="box-sizing: border-box;"</nowiki></code> | |||
| <div style="width: 100px; padding: 20px; border: 5px solid red; background-color: #f0f0f0; box-sizing: border-box;">Box content. (This box is 100px wide, including padding/border)</div> | |||
|} | |} | ||
</div> | </div> | ||
</div> | </div> | ||
{{clear}} | {{clear}} | ||
Revision as of 11:03, 12 July 2025
This page serves as a comprehensive guide for wiki editors to understand and effectively use various editing syntax and CSS styling within the Starship Simulator wiki. This knowledge is crucial for creating well-formatted, visually appealing, and dynamic pages.
Introduction
This wiki uses MediaWiki's own simplified markup, but also incorporates standard HTML tags and inline CSS for more advanced formatting and layout control. Additionally, MediaWiki provides its own unique tags and parser functions that are essential for template creation and specialized content display.
Understanding these tools will allow you to:
- Format text and elements precisely.
- Create custom layouts and boxes.
- Develop robust and flexible templates.
- Display code examples without unintended rendering.
This guide is divided into the following sections:
- Editing Syntax: Covers both standard HTML elements and MediaWiki-specific tags/functions for content structure and processing.
- Styling with CSS: Explains how to apply visual properties to elements using CSS.
Editing Syntax
This section covers the core syntax used for structuring content on this wiki, including common HTML tags and MediaWiki's specialized tags and parser functions.