Abdullelah Almubarak نشر 1 يوليو أرسل تقرير نشر 1 يوليو حولت لساعات و انا سيء جدا في css بس اتعلمه ولا وجدت حل <div class="items-shop" > {{-- <div> <img src="{{asset("b4f8c7125fec5a56f171c2a8ccc25b72.jpg")}}" > </div> --}} {{-- <div > --}} {{-- <img src="{{asset("pc.jpg")}}" > </div> <div> <img src="{{asset("lap.jpg")}}" > </div> <div> <img src="{{asset("motherboard.png")}}" > </div> <div > <img src="{{asset("pcNV.jpg")}}" > </div> <div> <img src="{{asset("8pc.png")}}" > </div> --}} @foreach ($products as $product) <div> @foreach ($product_images as $images) @if($images->product_id==$product->id) <a href="/"> <img src="{{asset("img")}}" > </a> @break @endif @endforeach <ul> <li class="prname">{{name}}</li> <hr> <li class="pprice"> <a href="/" style="grid-area: price"> price </a> </li> <br> <hr> <br> <li class="paction"> {{-- <ul class="bottom-item"> <li><i class="fa fa-search" aria-hidden="true"></i></li> <li><button>اضافة للسلة</button></li> <li><i class="fa fa-heart-o" aria-hidden="true"></i></li> </ul> --}} <div class="last"> <ul class="bottom-item"> <li><i class="fa fa-search" aria-hidden="true"></i></li> <li><i class="fa fa-cart-plus" aria-hidden="true"></i></li> <li><i class="fa fa-heart-o" aria-hidden="true"></i></li> </ul> </div> </li> </ul> </div> @endforeach </div> .items-shop{ margin-top: 40px; /* display: grid; grid-template-columns: auto auto auto auto; */ /* flex: 0; */ display: grid; grid-template-columns: repeat(auto-fit,20%); grid-auto-rows: 22vmax; /* flex-direction: row; */ justify-content: center; /* align-items: end; */ /* align-items: unsafe; */ /* align-items: stretch; */ /* align-content: space-between; */ gap: 4em; row-gap: 8vmax; /* margin: 5px; */ } .items-shop div:not(.last){ /* border: 3px solid black; justify-content: center; display: flex; justify-content: center; */ /* margin-bottom: 20vh; */ border-bottom: 10vmax solid white; /* margin-bottom: 50px; */ } .items-shop div img { /* flex: 1; */ object-fit: fill; width: 100%; height: 100%; /* border: 5px solid white; */ /* object-fit: fill; */ } .items-shop div a{ display: inline; margin: 0; padding: 0; } .items-shop div ul { list-style-type: none; /* display: block; */ /* display: ; */ margin: 0; padding: 0; /* overflow: hidden; */ /* overflow-wrap: break-word; */ /* word-break: unset; */ /* margin-bottom: -25px; */ /* border:solid white; border-width: 100%; */ /* height: 25vh; */ /* background-color: white; */ /* inline-size: min-content; */ /* font-size: clamp(30px,1vmax,60px); */ font-size: 1vmax; /* word-wrap: none; */ /* display: flex; flex-direction: column; */ /* font-weight: bolder; */ /* font-size: 70%; */ /* overflow-x: auto; */ } /* .items-shop div ul li { align-items: end; word-break: break-all; } */ .prname { display: inline; margin: 0; /* white-space: pre; */ /* word-break: keep-all; */ /* white-space: nowrap; overflow: hidden; text-overflow: clip; width: 20vw */ } .items-shop hr { width: 99.9%; height: 1px; background: #ed1d61; font-size: 0; border: 0; } .bottom-item { display: flex; /* position: absolute; */ top: 0; bottom: 0; flex-direction: row; justify-content: space-around; list-style: none; /* gap: 3em; */ } .bottom-item li{ padding: 5px ; /* height: 2vmax; */ width: 2vmax; /* border: 2px solid; */ /* box-shadow: 1px 2px rgba(0, 0, 0, 0.573); */ background: linear-gradient(to right,rgb(51, 67, 148),rgb(68, 55, 140)); /* font-size: 1vmax; */ border-radius: 20px; text-align: center; align-content: baseline; /* display: inline-block; */ /* max-width: 10px; */ } 1 اقتباس
0 Mustafa Suleiman نشر 1 يوليو أرسل تقرير نشر 1 يوليو من الطبيعي أن تتحرك الأيقونات من مكانها لأنها تأتي أسفل العنوان، والنص الخاص بالعنوان يستحوذ على المساحة المناسبة للنص، بالتالي لحل المشكلة عليك اقتطاع الجزء الباقي من النص لكي لا يظهر على سطر جديد من خلال خاصية white-space كالتالي: .prname { font-weight: bold; font-size: 1.1rem; margin-bottom: 0.5rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } بالنسبة لتحسين التنسيقات، فإليك تصميم أفضل: body { background-color: #f0f2f5; padding: 20px; } .items-shop { margin-top: 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; } .items-shop div:not(.last) { background-color: white; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); overflow: hidden; display: flex; flex-direction: column; } .items-shop div a { display: block; height: 200px; } .items-shop div img { width: 100%; height: 100%; object-fit: cover; } .items-shop div ul { list-style-type: none; padding: 1rem; margin: 0; font-size: 1rem; display: flex; flex-direction: column; flex-grow: 1; } .prname { font-weight: bold; font-size: 1.1rem; margin-bottom: 0.5rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .pprice a { color: #007bff; font-weight: bold; text-decoration: none; } .items-shop hr { width: 100%; height: 1px; background-color: #eee; border: 0; margin: 0.5rem 0; } .paction { margin-top: auto; padding-top: 1rem; } .bottom-item { display: flex; justify-content: space-around; list-style: none; padding: 0; margin: 0; } .bottom-item li { display: flex; justify-content: center; align-items: center; height: 40px; width: 40px; background: linear-gradient(to right, rgb(51, 67, 148), rgb(68, 55, 140)); color: white; border-radius: 50%; cursor: pointer; transition: transform 0.2s; } .bottom-item li:hover { transform: scale(1.1); } وعليك إزالة الـ <br> والـ <hr> الزائدة من HTML لأنّ التنسيق السابق يُضيف هوامش من خلال margin. اقتباس
0 Abdullelah Almubarak نشر 1 يوليو الكاتب أرسل تقرير نشر 1 يوليو بتاريخ 30 دقائق مضت قال Mustafa Suleiman: .prname { font-weight: bold; font-size: 1.1rem; margin-bottom: 0.5rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } شكراً. المشكلة ان اريد عرض اسم المنتج بدون ان يختفي جزء منه اقتباس
السؤال
Abdullelah Almubarak
حولت لساعات و انا سيء جدا في css بس اتعلمه ولا وجدت حل
2 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.