“我遇到了一个问题,在我的计算机上一切看起来都很好,但在手机上却很糟糕。这些字段造成了最大的麻烦;我似乎无法让它们在移动设备上堆叠在一起。可以有人帮助我吗?”
/* Body styling */
body {
font-family: 'Arial', sans-serif;
background-color: #f2f2f2;
margin: 0;
}
/* Styling for container */
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center; /* Added to vertically center the content */
min-height: 100vh;
}
/* Styling for calculator container */
.calculator-container {
width:794px;
transform:translatex(835px) translatey(192px);
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
margin-top: 20px;
}
/* Styling for summary tab */
.summary-tab {
width:820px;
transform:translatex(823px) translatey(203px);
height:310px;
line-height:9.4px;
background-color: #fff;
padding: 10px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
margin-top: 20px;
}
h1 {
color: #333;
}
label {
display: block;
margin: 10px 0;
color: #555;
}
select, input {
margin: 5px 0 15px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
width: 100%;
box-sizing: border-box;
}
button {
background-color: #4caf50;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
#totalPrice {
margin-top: 20px;
font-size: 18px;
font-weight: bold;
color: #333;
margin-left: 18px;
}
#dimensions {
height:127px;
display: flex;
flex-direction: column;
align-items: center;
}
#heightLabel {
display: none;
}
@media (min-width: 600px) {
#dimensions {
flex-direction: row;
justify-content: space-between;
}
}
/* Styling for color options */
.color-options {
column-gap: 20px;
display: flex;
flex-wrap: wrap;
margin-bottom: 5px;
row-gap: 10px;
}
/* Styling for individual color option */
.color-options input[type="radio"] {
display: none;
}
.color-options label {
display: flex;
align-items: center;
cursor: pointer;
border: 2px solid #ddd;
padding: 5px;
border-radius: 5px;
}
/* Styling for selected color option */
.color-options input[type="radio"]:checked + label {
background-color: #ddd;
font-weight: bold;
}
/* Label */
.calculator-container label{
text-align:left;
font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;
font-size:19px;
line-height:21px;
}
/* Styling for file upload */
#fileSection {
margin-top: 15px;
}
#fileNameDisplay {
margin-top: 10px;
font-style: italic;
color: #555;
}
/* Background image styling */
body {
background-image: url("bcg.png");
background-color: #cccccc;
}
/* Styling for summary tab */
.summary-tab {
background-color: #fff;
padding: 10px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
margin-top: 20px;
margin-bottom: 20px; /* Added margin-bottom to create space between summary and next element */
}
.summary-tab h4 {
color: #333;
}
.summary-tab div {
margin-top: 30px;
font-size: 18px; /* Adjust the font size to match your design */
color: #000000;
margin-right: 80px;
margin-bottom: 80px;
margin-left: 80px;
}
/* Styling for motor options */
#motorSection {
display: none;
margin-top: 15px;
}
.motor-options {
column-gap: 20px;
display: flex;
flex-wrap: wrap;
margin-bottom: 5px;
row-gap: 10px;
}
.motor-options input[type="radio"] {
display: none;
}
.motor-options label {
display: flex;
align-items: center;
cursor: pointer;
border: 2px solid #ddd;
padding: 5px;
border-radius: 5px;
}
.motor-options input[type="radio"]:checked + label {
background-color: #ddd;
font-weight: bold;
}
#totalSummary p.empty-option {
font-weight: bold;
font-size: larger;
}
/* Styling for other options */
.material-options {
margin-top: 10px;
text-align:left;
}
.material-options input[type="radio"] {
display: none;
}
.material-options label {
display: inline-block;
cursor: pointer;
}
.material-options label::before {
content: '';
display: inline-block;
width: 20px;
height: 20px;
border: 2px solid #ccc;
border-radius: 50%;
margin-right: 5px;
vertical-align: middle;
}
.material-options input[type="radio"]:checked + label::before {
background-color: #007bff;
border-color: #007bff;
}
/* Styling for email form container */
#emailFormContainer {
display: none; /* Initially hide the email form container */
}
/* Dropdown Meni */
#itemDropdown{
width:277px;
position:relative;
left:-257px;
background-color:#f3f5f5;
}
/* Za Duzinu text */
.duzina label {
position:relative;
top:-94px;
left:366px;
}
/* Za Duzinu */
.duzina input[type="number"] {
width: 277px;
position:relative;
top:-94px;
left:103px;;
background-color:#f3f5f5;
}
/* Za Visinu text */
.visina label {
position:relative;
left:366px;
top:-143px;
}
/* Za Visinu */
.visina input[type="number"] {
width: 277px;
position:relative;
left:-8px;
top:20px;
background-color:#f3f5f5;
}
/* Za Sirinu text */
.sirina label {
position:relative;
top:-53px;
}
/* Za Sirinu */
.sirina input[type="number"] {
width: 277px;
position:relative;
left:-257px;
top:-49px;
background-color:#f3f5f5;
}
/* Kalendar */
#datepickerSection {
display: none; /* Hide the date picker section by default */
margin-top: 10px; /* Adjust the margin as needed */
}
.datum-text {
display: block;
margin-bottom: 5px;
color: #555; /* Adjust the color as needed */
}
.datepicker {
background-color:#f3f5f5;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
width: 277px;
position:relative;
left:-257px;
box-sizing: border-box;
}
/* Za upload formu*/
.upload {
width: 277px;
position:relative;
left:-318px;
width:123px;
}
/* Upload buton */
.upload {
display: inline-block;
padding: 8px 16px;
background-color: #007bff; /* Change the background color as needed */
color: #fff; /* Change the text color as needed */
border-radius: 4px;
cursor: pointer;
}
/* Upload kad se prelazi misem*/
.upload:hover {
background-color: #0056b3; /* Change the background color on hover */
}
/* Za text ime slike */
#fileNameDisplay {
position:relative;
left:-200px;
color:#ee4390;
}
/* Greska odabrani fajl nije slika staviti tamo funkciju da direktno iz css ubacuje odavde */
.error-text1 {
color: red;
}
/* X dugme otkaze upload slike */
.cancel-button {
background-color: transparent;
color: red;
border: none;
cursor: pointer;
font-size: 16px;
margin-left: 5px; /* Adjust as needed */
}
“我已经尝试了所有方法,希望这些字段能够按照应有的顺序堆叠在一起。”试过
@media all and (min-width:960px) and (max-width: 1024px) {
/* put your css styles in here */
}
@media all and (min-width:801px) and (max-width: 959px) {
/* put your css styles in here */
}
@media all and (min-width:769px) and (max-width: 800px) {
/* put your css styles in here */
}
@media all and (min-width:569px) and (max-width: 768px) {
/* put your css styles in here */
}
@media all and (min-width:481px) and (max-width: 568px) {
/* put your css styles in here */
}
@media all and (min-width:321px) and (max-width: 480px) {
/* put your css styles in here */
}
@media all and (min-width:0px) and (max-width: 320px) {
/* put your css styles in here */
}
not working
您在每个输入字段中使用
position: relative
与无法应用的 Flex 样式和媒体查询直接冲突。相对位置会在元素的原点处留下一个间隙,并且 positions 元素会停留在您将其偏移到的任何位置,因此它对您尝试使用的这些响应式属性不友好。
从表单元素中删除position属性(并清除现在无用的
top
、bottom
、left
或right
样式),然后我建议首先从移动角度尝试使用弹性框。从那里您可以使用媒体查询使桌面布局看起来不错。