Skip to content

Commit 2d1b77a

Browse files
committed
Add more class to specify image position.
1 parent 7c00244 commit 2d1b77a

3 files changed

Lines changed: 28 additions & 22 deletions

File tree

_posts/2019-08-08-text-and-typography.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ math: true
88
image: /assets/img/sample/devices-mockup.png
99
---
1010

11-
This article is to show markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
11+
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
1212

1313

1414
## Titles
@@ -89,14 +89,18 @@ You can change the size of the picture:
8989
![Desktop View](/assets/img/sample/mockup.png){: width="400"}
9090
_400px image width_
9191

92-
In addition, you can use class `left` or `right` to specify the image position (but in this case, the image caption is prohibited), for example:
92+
In addition, you can use class `normal` , `left` and `right` to specify the image position (but in these case, the image caption is prohibited), for example:
9393

94-
- To the left
94+
- Normal position
95+
96+
![Desktop View](/assets/img/sample/mockup.png){: width="350" class="normal"}
97+
98+
- Float to the left
9599

96100
![Desktop View](/assets/img/sample/mockup.png){: width="240" class="left"}
97101
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."
98102

99-
- To the right
103+
- Float to the right
100104

101105
![Desktop View](/assets/img/sample/mockup.png){: width="240" class="right"}
102106
"A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space. A repetitive and meaningless text is used to fill the space."

_posts/2019-08-09-getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
123123
1. Push any commit to `origin/master` to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
124124

125125
2. Browse to your repository on GitHub and choose the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings__Options__GitHub Pages_:
126-
![gh-pages-sources](/assets/img/sample/gh-pages-sources.png){: width="650"}
126+
![gh-pages-sources](/assets/img/sample/gh-pages-sources.png){: width="650" class="normal"}
127127

128128
3. Visit your website at the address indicated by GitHub.
129129

assets/css/_addon/main.scss

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ $sidebar-display: "sidebar-display";
8585
.site-title {
8686
text-align: center;
8787
a {
88-
// color: var(--site-title-color);
8988
font-weight: 900;
9089
font-size: 1.5rem;
9190
letter-spacing: .5px;
@@ -818,24 +817,27 @@ div.post-content .table-wrapper {
818817
word-wrap: break-word;
819818

820819
@mixin img($caption: false) {
821-
> img {
822-
&:not([style]) {
823-
&:not(.left):not(.right) {
824-
margin: .5rem 0;
825-
@include align-center;
826-
@if $caption {
827-
@include img-caption;
828-
}
829-
}
830-
&.left {
831-
float: left;
832-
margin: .75rem 1rem 1rem 0;
833-
}
834-
&.right {
835-
float: right;
836-
margin: .75rem 0 1rem 1rem;
820+
>img:not([style]) {
821+
margin: .5rem 0;
822+
823+
&:not(.normal):not(.left):not(.right) {
824+
@include align-center;
825+
826+
@if $caption {
827+
@include img-caption;
837828
}
838829
}
830+
831+
&.left {
832+
float: left;
833+
margin: .75rem 1rem 1rem 0;
834+
}
835+
836+
&.right {
837+
float: right;
838+
margin: .75rem 0 1rem 1rem;
839+
}
840+
839841
}
840842
}
841843

0 commit comments

Comments
 (0)