Skip to content

Commit 49da7a9

Browse files
Kedarnath R GubbiKedarnath R Gubbi
authored andcommitted
fix overflow issue on small screen
1 parent 831ef1c commit 49da7a9

1 file changed

Lines changed: 91 additions & 88 deletions

File tree

src/components/WhatWeDo/WhatWeDo.css

Lines changed: 91 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,191 +1,194 @@
11
.what-we-do-container {
22
padding: 20px;
33
text-align: left;
4-
max-width: 1200px; /* Center the container */
4+
max-width: 1200px;
55
margin: 0 auto;
6+
overflow-x: hidden; /* Prevent horizontal overflow */
67
}
78

89
.what-we-do-container h2 {
910
font-size: 2rem;
1011
color: #333;
1112
margin-bottom: 16px;
13+
word-wrap: break-word;
1214
}
1315

1416
.what-we-do-grid {
1517
display: grid;
16-
grid-template-columns: repeat(3, 1fr); /* Fixed 3 columns */
17-
gap: 16px;
18+
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Increased min-width for longer text */
19+
gap: 20px; /* Increased gap for better spacing */
1820
margin-top: 16px;
21+
width: 100%;
1922
}
2023

2124
.what-we-do-item {
2225
display: flex;
23-
align-items: flex-start; /* Align image and text to the top */
24-
gap: 12px; /* Space between image and text */
25-
text-decoration: none; /* Remove underline from anchor */
26-
color: inherit; /* Inherit text color */
27-
padding: 8px; /* Padding for clickable area */
28-
border-radius: 8px; /* Match image border-radius */
29-
transition: background-color 0.3s ease, box-shadow 0.3s ease; /* Smooth hover transition */
30-
cursor: pointer; /* Indicate clickability */
26+
align-items: flex-start;
27+
gap: 16px; /* Increased gap between image and text */
28+
text-decoration: none;
29+
color: inherit;
30+
padding: 16px; /* Increased padding */
31+
border-radius: 8px;
32+
transition: background-color 0.3s ease, box-shadow 0.3s ease;
33+
cursor: pointer;
34+
min-width: 0;
35+
overflow: hidden;
36+
min-height: fit-content; /* Allow natural height expansion */
3137
}
3238

3339
.what-we-do-item:hover {
34-
background-color: #f5f5f5; /* Subtle background on hover */
35-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow on hover */
40+
background-color: #f5f5f5;
41+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
3642
}
3743

3844
.what-we-do-item img {
39-
width: 100px; /* Fixed width for consistency */
40-
height: auto;
45+
width: 80px;
46+
height: 80px;
47+
object-fit: cover;
4148
border-radius: 8px;
42-
flex-shrink: 0; /* Prevent image from shrinking */
43-
}
44-
45-
.what-we-do-item img:hover {
46-
transform: scale(1.05);
47-
transition: transform 0.3s ease;
49+
flex-shrink: 0;
4850
}
4951

5052
.what-we-do-text {
5153
display: flex;
5254
flex-direction: column;
53-
flex: 1; /* Take remaining space */
54-
min-width: 0; /* Prevent text overflow */
55+
flex: 1;
56+
min-width: 0;
5557
}
5658

5759
.what-we-do-text h3 {
58-
margin: 0 0 8px 0;
60+
margin: 0 0 12px 0; /* Increased margin */
5961
font-size: 1.1rem;
6062
color: #333;
6163
line-height: 1.3;
64+
word-wrap: break-word;
65+
overflow-wrap: break-word;
6266
}
6367

6468
.what-we-do-text p {
6569
margin: 0;
6670
font-size: 0.85rem;
6771
color: #666;
68-
line-height: 1.4;
69-
overflow-wrap: break-word; /* Handle long descriptions */
70-
}
71-
72-
/* Responsive design for smaller screens */
73-
@media (max-width: 768px) {
74-
.what-we-do-grid {
75-
grid-template-columns: repeat(2, 1fr); /* 2 columns on medium screens */
76-
}
72+
line-height: 1.5; /* Improved line height for readability */
73+
word-wrap: break-word;
74+
overflow-wrap: break-word;
75+
hyphens: auto;
76+
77+
/* REMOVED: Text clamping - now shows full text */
78+
/* display: -webkit-box; */
79+
/* -webkit-line-clamp: 4; */
80+
/* -webkit-box-orient: vertical; */
81+
/* overflow: hidden; */
7782
}
7883

79-
@media (max-width: 480px) {
84+
/* Improved responsive breakpoints */
85+
@media (max-width: 1024px) {
8086
.what-we-do-grid {
81-
grid-template-columns: 1fr; /* 1 column on small screens */
82-
}
83-
.what-we-do-item {
84-
flex-direction: column; /* Stack image and text on small screens */
85-
align-items: flex-start;
86-
}
87-
.what-we-do-item img {
88-
margin-bottom: 8px; /* Space between image and text when stacked */
87+
grid-template-columns: repeat(2, 1fr);
88+
gap: 18px;
8989
}
9090
}
9191

92-
/* Dark mode support */
93-
.user-collaboration-dark-mode .what-we-do-container h2,
94-
.user-collaboration-dark-mode .what-we-do-text h3 {
95-
color: #fff;
96-
}
97-
98-
.user-collaboration-dark-mode .what-we-do-text p {
99-
color: #ccc;
100-
}
101-
102-
.user-collaboration-dark-mode .what-we-do-item:hover {
103-
background-color: #444; /* Darker background on hover in dark mode */
104-
}
105-
106-
/* Enhanced mobile styles */
10792
@media (max-width: 768px) {
10893
.what-we-do-container {
109-
padding: 16px; /* Reduce padding on tablets */
94+
padding: 16px;
11095
}
11196

11297
.what-we-do-grid {
113-
grid-template-columns: repeat(2, 1fr);
114-
gap: 12px; /* Slightly smaller gap */
98+
grid-template-columns: 1fr;
99+
gap: 20px;
115100
}
116101

117-
.what-we-do-container h2 {
118-
font-size: 1.75rem; /* Slightly smaller heading */
102+
.what-we-do-item {
103+
padding: 16px;
119104
}
120105
}
121106

122107
@media (max-width: 480px) {
123108
.what-we-do-container {
124-
padding: 12px; /* More compact padding */
125-
}
126-
127-
.what-we-do-grid {
128-
grid-template-columns: 1fr;
129-
gap: 16px; /* More space between items when stacked */
109+
padding: 12px;
130110
}
131111

132112
.what-we-do-container h2 {
133-
font-size: 1.5rem; /* Smaller heading for phones */
134-
text-align: center; /* Center the main heading */
135-
margin-bottom: 20px;
113+
font-size: 1.5rem;
114+
text-align: center;
136115
}
137116

138117
.what-we-do-item {
139118
flex-direction: column;
140-
align-items: center; /* Center everything on mobile */
119+
align-items: center;
141120
text-align: center;
142-
padding: 12px;
121+
padding: 20px; /* More padding for mobile */
143122
}
144123

145124
.what-we-do-item img {
146-
width: 80px; /* Slightly smaller images on mobile */
147-
margin-bottom: 12px;
125+
width: 100px; /* Larger image on mobile since text is below */
126+
height: 100px;
127+
margin-bottom: 16px;
148128
}
149129

150130
.what-we-do-text h3 {
151-
font-size: 1rem; /* Adjust heading size */
152-
margin-bottom: 6px;
131+
font-size: 1.2rem; /* Larger heading on mobile */
132+
margin-bottom: 12px;
153133
}
154134

155135
.what-we-do-text p {
156-
font-size: 0.8rem; /* Slightly smaller text */
157-
line-height: 1.5; /* Better readability */
136+
font-size: 0.9rem; /* Slightly larger text for better readability */
137+
line-height: 1.6;
138+
/* Full text displayed - no truncation */
158139
}
159140
}
160141

161-
/* Extra small screens */
162142
@media (max-width: 320px) {
163143
.what-we-do-container {
164-
padding: 8px;
144+
padding: 10px;
145+
}
146+
147+
.what-we-do-grid {
148+
gap: 16px;
149+
}
150+
151+
.what-we-do-item {
152+
padding: 16px;
165153
}
166154

167155
.what-we-do-item img {
168-
width: 70px; /* Even smaller images for very small screens */
156+
width: 90px;
157+
height: 90px;
169158
}
170159

171160
.what-we-do-text h3 {
172-
font-size: 0.95rem;
161+
font-size: 1.1rem;
173162
}
174163

175164
.what-we-do-text p {
176-
font-size: 0.75rem;
165+
font-size: 0.85rem;
166+
/* Still showing full text */
177167
}
178168
}
179169

180-
/* Optional: Add touch-friendly hover states */
170+
/* Dark mode support */
171+
.user-collaboration-dark-mode .what-we-do-container h2,
172+
.user-collaboration-dark-mode .what-we-do-text h3 {
173+
color: #fff;
174+
}
175+
176+
.user-collaboration-dark-mode .what-we-do-text p {
177+
color: #ccc;
178+
}
179+
180+
.user-collaboration-dark-mode .what-we-do-item:hover {
181+
background-color: #444;
182+
}
183+
184+
/* Touch-friendly states */
181185
@media (hover: none) and (pointer: coarse) {
182186
.what-we-do-item:hover {
183-
background-color: transparent; /* Remove hover on touch devices */
187+
background-color: transparent;
184188
box-shadow: none;
185189
}
186190

187191
.what-we-do-item:active {
188-
background-color: #f0f0f0; /* Add active state for touch */
192+
background-color: #f0f0f0;
189193
}
190194
}
191-

0 commit comments

Comments
 (0)