Skip to content

Commit d75b8d0

Browse files
committed
improve css for responsive columns
1 parent 3ad1ee0 commit d75b8d0

4 files changed

Lines changed: 46 additions & 10 deletions

File tree

docs/make.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ Draft = false
128128
```
129129
=#
130130
makedocs(;
131-
draft=false,
132-
#draft=true,
133-
#warnonly=[:cross_references, :autodocs_block],
131+
draft=true,
134132
sitename="OptimalControl.jl",
135133
format=Documenter.HTML(;
136134
repolink="https://" * repo_url,
@@ -141,6 +139,7 @@ makedocs(;
141139
assets=[
142140
asset("https://control-toolbox.org/assets/css/documentation.css"),
143141
asset("https://control-toolbox.org/assets/js/documentation.js"),
142+
"assets/custom.css",
144143
],
145144
),
146145
pages=[

docs/src/assets/custom.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* Responsive layout for two-column content */
2+
.responsive-columns-left-priority {
3+
display: flex;
4+
gap: 1rem;
5+
align-items: flex-start;
6+
margin-bottom: 1em;
7+
}
8+
9+
.responsive-columns-left-priority > div {
10+
flex: 1;
11+
min-width: 0;
12+
transition: opacity 0.5s ease-in-out, flex 0.5s ease-in-out, max-width 0.5s ease-in-out, max-height 0.5s ease-in-out;
13+
}
14+
15+
.responsive-columns-left-priority > div:last-child {
16+
opacity: 1;
17+
max-width: 100%;
18+
max-height: none;
19+
}
20+
21+
/* Media query for screens smaller than 700px */
22+
@media (max-width: 700px) {
23+
.responsive-columns-left-priority > div:last-child {
24+
opacity: 0;
25+
max-width: 0;
26+
max-height: 0;
27+
flex: 0 0 0;
28+
overflow: hidden;
29+
margin: 0;
30+
padding: 0;
31+
}
32+
33+
.responsive-columns-left-priority > div:first-child {
34+
flex: 1 1 100%;
35+
}
36+
}

docs/src/example-double-integrator-energy.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ using Plots
3434
Let us define the problem with the [`@def`](@ref) macro:
3535

3636
```@raw html
37-
<div style="display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1em;">
38-
<div style="flex: 1;">
37+
<div class="responsive-columns-left-priority">
38+
<div>
3939
```
4040

4141
```@example main
@@ -57,7 +57,7 @@ nothing # hide
5757

5858
```@raw html
5959
</div>
60-
<div style="flex: 1;">
60+
<div>
6161
```
6262

6363
### Mathematical formulation
@@ -68,7 +68,8 @@ nothing # hide
6868
& \text{subject to} \\
6969
& && \dot{x}_1(t) = x_2(t), \\[0.5em]
7070
& && \dot{x}_2(t) = u(t), \\[1.0em]
71-
& && x(0) = (-1,0), \quad x(1) = (0,0).
71+
& && x(0) = (-1,0), \\[0.5em]
72+
& && x(1) = (0,0).
7273
\end{aligned}
7374
```
7475

docs/src/example-double-integrator-time.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ using Plots
3333
Let us define the problem:
3434

3535
```@raw html
36-
<div style="display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1em;">
37-
<div style="flex: 1;">
36+
<div class="responsive-columns-left-priority">
37+
<div>
3838
```
3939

4040
```@example main
@@ -62,7 +62,7 @@ nothing # hide
6262

6363
```@raw html
6464
</div>
65-
<div style="flex: 1;">
65+
<div>
6666
```
6767

6868
### Mathematical formulation

0 commit comments

Comments
 (0)