To centerize fixed element
In order to center fixed element, use the following technique. This codes is also used in this html file.header {
position: fixed;
top: 10px;
z-index: 120;
width: 80%;
left: 50%;
transform: translateX(-50%);
}
Show your codes with Prism Library.
# Prismの使い方 コードを美しく見せるcss/jsライブラリ さまざまなプログラミング言語のシンタックスに対応している。 ##使い方 preタグとcodeタグで囲む。<pre><code class="language-html">表示させたいコード</code></pre>
##コードハイライトで使いやすそうなPrismのプラグイン
* Line Number
行番号を表示させてくれる。
* Keep Markup
注目してほしいコードの部分を<mark></mark>タグで囲むと強調される。
* Copy to Clipboard Button
コードをクリップボードにコピーできるようになる。
The Prism library is a lightweight, flexible, and extensible syntax highlighting library specifically designed for modern web development. It has a wide range of color-coded syntaxs corresponding to programming languages. This website also takes advantage of these syntax highlighting library. Here's way to step by step apply it for your sharing codes.
- Go to the Prism website and select your desirable theme. This theme controls the apperance of code snippets.
- The multiple code selections of syntax are shown. Select your target languages and formats.
- Lastly, you can choose any favorite plugins to make your code look distinct. The below selected ones are what this site is applying for codes' indication.
- Once your preference is determined, scroll to the bottom of page and click
DOWNLOAD JS
andDOWNLOAD CSS
. - Place downloaded files into your working directory like following:
- Load both .css and .js files within your HTML code. It might seem so:





<!DOCTYPE html>
<html lang="en">
<head>
<title>Apply CSS and JS Files into HTML</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="prism.css">
</head>
<body>
<h1>Apply CSS and JS Files into HTML</h1>
<p>This web site applies Prism Library.</p>
<script src="prism.js"></script>
</body>
</html>
My Top Navigation
This website indicates a fixed navigation menu on the top of page. This is easy to create. Firstly, the structure of html looks like so:<header>
<nav>
<ul>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
</ul>
</nav>
</header>
Then add the following css cascading styles.
header {
position: fixed;
top: 10px;
z-index: 120;
width: 80%;
left: 50%;
transform: translateX(-50%);
background-color: white;
border-radius: 22px;
box-shadow: 2px 2px 4px 1px gainsboro;
}
header > nav > ul {
list-style-type: none;
padding: 0;
display: flex;
justify-content: space-between;
margin: 0 40px;
}
header > nav > ul > li {
margin: 0;
}
header > nav > ul > li > a {
text-decoration: none;
display: inline-block;
/* border: 4px solid antiquewhite; */
background-color: white;
border-radius: 12px;
padding: 14px 6px;
transition: 0.5s;
}
header > nav > ul > li > a:hover {
background-color: black;
color: white;
transition: 0.5s;
}
Selectors
Selectors is a limit to which fields to have effects of css.
- Definition
- Selectors are patterns to target elements on a web page.
- Types
- Universal Selectors(*) Target all elements.
- Type Selectors(<p>) Targets a specific HTML tag.
- Class Selector (.class-name) Targets elements with a specific class.
- ID Selector (#id-name) Targets an element with an unique ID.
- Attribute Selector([type="text"]) Targets elements based on attributes.
- Pseudo-Classes(:hover, :nth-of-type(1)) Apply styles based on the element's state or position.
Font-Family property
Serif
- Definition
- 明朝体を意味します。
- Serif fonts have small decorative strokes (serifs) at the ends of characters' lines.
- Apperance
- Traditional, formal, and classic
- Usage
- Commonly used in printed materials like books, newspapers and formal documents, as the serifs guide reader's eye along the line of text.
- Example
-
- Times New Roman
- Georgia
- Garamond
Sans-serif
- Definition
- ゴシック体を意味します。
- Sans-serif means "without serifs" (from the French word
sans,
meaning "without"). - Apperance
- Modern, clean, and minimalist
- Usage
- Commonly used in digital content, like websites and apps, as they are easier to read onscreens.
- Example
-
- Arial
- Helvetica
- Verdana
Properties and Values
Box Model
Cascade and Sppecificity
Positioning
Flex Box
Grid Layout
Media Queries
Pseudo-classes and Pseudo-elements
Responsive Design
Z-Index
Transitions and Animations
Units
Variables
Shorthand properties
list-style (shorthand property for list)
HTML provide two types of list: <ul> and <ol>.
<ul> stands for an unordered list, while <ol> stands for an ordered list.
values | appearance | meaning |
---|---|---|
disc |
|
the solid circle that is commonly used as the default bullet point in an unorderedl list. |
square |
|
|
circle |
|
|
armenin |
|
|
decimal |
|
|
decimal-leading-zero |
|
|
georgian |
|
|
lower-alpha |
|
|
upper-alpha |
|
|
lower-greek |
|
|
lower-latin |
|
|
upper-latin |
|
|
lower-roman |
|
|
upper-roman |
|
HTML
Content Models
- Flow Content
- Definition: Elements that can be used as part of the general structure of a documemt.
- Can contain: Other flow content, form elements, and script elements.
- Example
- <div>, <p>, <a>, <section>, <header>, <footer>
- Sectioning Content
- Metadata Content
- Embedded Content
- Form Content
- Script Content
- Transparent Content