質問編集履歴
3
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -109,4 +109,15 @@
|
|
109
109
|
text-align: left;
|
110
110
|
}
|
111
111
|
```
|
112
|
-

|
112
|
+

|
113
|
+
###追記3
|
114
|
+
追記2から以下のように変更した場合です。
|
115
|
+
|
116
|
+
```css
|
117
|
+
.post-left img {
|
118
|
+
display: block;
|
119
|
+
min-width: 100%;
|
120
|
+
min-height: 100%;
|
121
|
+
object-fit: cover;
|
122
|
+
}```
|
123
|
+

|
2
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -66,4 +66,47 @@
|
|
66
66
|
display: block; /* 不要かもしれません */
|
67
67
|
}
|
68
68
|
```
|
69
|
-

|
69
|
+

|
70
|
+
###追記2
|
71
|
+
cssを以下のようにした場合、こちらのようになります。
|
72
|
+
まだ、3番の写真が縮む形になってします。
|
73
|
+
(新たに判明したのが、iPhoneから見た場合、うまくトリミングされます。パソコン、アンドロイドから見た場合、現在のように表示されます)
|
74
|
+
```css
|
75
|
+
.posts-index {
|
76
|
+
position: relative;
|
77
|
+
padding: 5px 10px;
|
78
|
+
background-color: white;
|
79
|
+
overflow: hidden;
|
80
|
+
}
|
81
|
+
.post-left {
|
82
|
+
float: left;
|
83
|
+
/* width: 10%; */
|
84
|
+
|
85
|
+
/* 追加 */
|
86
|
+
width: 170px;
|
87
|
+
height: 120px;
|
88
|
+
overflow: hidden;
|
89
|
+
}
|
90
|
+
.post-left img {
|
91
|
+
/*
|
92
|
+
width: 170px;
|
93
|
+
height: 120px;
|
94
|
+
*/
|
95
|
+
/* 追加 */
|
96
|
+
display: block;
|
97
|
+
width: 100%;
|
98
|
+
height: 100%;
|
99
|
+
object-fit: cover;
|
100
|
+
}
|
101
|
+
.post-right {
|
102
|
+
float: left;
|
103
|
+
|
104
|
+
/* width: 90%; */
|
105
|
+
width: calc(100% - 130px - 170px);
|
106
|
+
|
107
|
+
padding-left: 130px;
|
108
|
+
margin: 8px 0;
|
109
|
+
text-align: left;
|
110
|
+
}
|
111
|
+
```
|
112
|
+

|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,19 +7,38 @@
|
|
7
7
|
3.縦長写真です。縦側がトリミングされず、縮んでしまいます。
|
8
8
|
|
9
9
|
```css
|
10
|
+
.posts-index{
|
11
|
+
position: relative;
|
12
|
+
padding: 5px 10px;
|
13
|
+
background-color: white;
|
14
|
+
overflow: hidden;
|
15
|
+
}
|
16
|
+
.post-left {
|
17
|
+
float: left;
|
18
|
+
width: 10%;
|
19
|
+
}
|
10
|
-
.post-
|
20
|
+
.post-left img {
|
11
21
|
width: 170px;
|
12
22
|
height: 120px;
|
13
23
|
object-fit: cover;
|
14
24
|
}
|
25
|
+
.post-right {
|
26
|
+
float: left;
|
27
|
+
width: 90%;
|
28
|
+
padding-left: 130px;
|
29
|
+
margin: 8px 0;
|
30
|
+
text-align: left;
|
31
|
+
}
|
15
32
|
```
|
16
33
|
```html
|
17
34
|
<% @posts.each do |post| %>
|
18
|
-
<div class="posts-index
|
35
|
+
<div class="posts-index">
|
19
36
|
<div class="post-left">
|
20
37
|
<%= image_tag post.image_name.thumb.url %>
|
21
38
|
</div>
|
39
|
+
<div class="post-right">
|
22
40
|
<p><%= post.title %></p>
|
41
|
+
</div>
|
23
42
|
</div>
|
24
43
|
<% end %>
|
25
44
|
```
|
@@ -32,4 +51,19 @@
|
|
32
51
|
}
|
33
52
|
```
|
34
53
|
結論、横長写真によって、うまくトリミングされるものと、されないものがあります。
|
35
|
-
これらの解決方法をお分かりの方、ぜひよろしくお願いします。
|
54
|
+
これらの解決方法をお分かりの方、ぜひよろしくお願いします。
|
55
|
+
###追記
|
56
|
+
cssを以下のように変更した場合
|
57
|
+
```css
|
58
|
+
.post-left {
|
59
|
+
width: 170px;
|
60
|
+
height: 120px;
|
61
|
+
}
|
62
|
+
.post-left img {
|
63
|
+
width: 100%;
|
64
|
+
height: 100%;
|
65
|
+
object-fit: cover;
|
66
|
+
display: block; /* 不要かもしれません */
|
67
|
+
}
|
68
|
+
```
|
69
|
+

|