【发布时间】:2020-08-14 04:20:31
【问题描述】:
我正在为所有设备创建一个响应式配置文件页面,因此我使用 bootstrap 4 网格系统来划分页面以满足我的需要我希望页面看起来像这样:- 在桌面上,像这样:-
所以我尝试的是 col-sm 负责任地处理小屏幕 代码sn-p
/* Profile Main Page Cards , holders...etc */
.holderTitle{
font-family: hana;
font-size: 34px !important;
color:black !important;
text-align: center !important;
}
/* Profile Image Thubmail */
.ProfileAvatar{
border: 1px solid #ddd; /* Gray border */
border-radius: 4px; /* Rounded border */
padding: 5px; /* Some padding */
width: 150px; /* Set a small width */
}
/* Add a hover effect (blue shadow) */
.ProfileAvatar:hover {
box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
}
.holderText{
color:black !important;
}
.messagebtn{
text-align: center !important;
font-family: hana !important;
}
.fontawsomeBIO{
font-family: hana !important;
}
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops ( large Mointer )
*/
@media (min-width: 1281px) {
/* Profiler Card and Container (Profile Holder) on large Screen */
.profileholder{
width:45%;
height: auto;
}
/* ProfileHolder Ends Here */
/* Profile Content Card And Container */
.ProfileContent{
width: 100%;
height: auto;
}
}
/*
##Device = Laptops, Desktops
##Screen = B/w 1025px to 1280px
*/
@media (min-width: 1025px) and (max-width: 1280px) {
.profileholder{
width:70%;
height: auto;
}
/* ProfileHolder Ends Here */
/* Profile Content Card And Container */
.ProfileContent{
width: 100%;
height: auto;
}
}
/*
##Device = Tablets, Ipads (portrait)
##Screen = B/w 768px to 1024px
*/
@media (min-width: 768px) and (max-width: 1024px) {
.profileholder{
width:95%;
height: auto;
}
/* ProfileHolder Ends Here */
/* Profile Content Card And Container */
.ProfileContent{
width: 100%;
height: auto;
}
}
/*
##Device = Tablets, Ipads (landscape)
##Screen = B/w 768px to 1024px
*/
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
.profileholder{
width:75%;
height: auto;
}
/* ProfileHolder Ends Here */
/* Profile Content Card And Container */
.ProfileContent{
width: 100%;
height: auto;
}
}
/*
##Device = Low Resolution Tablets, Mobiles (Landscape)
##Screen = B/w 481px to 767px
*/
@media (min-width: 481px) and (max-width: 767px) {
.profileholder{
width:85%;
height: auto;
}
/* ProfileHolder Ends Here */
/* Profile Content Card And Container */
.ProfileContent{
width: 90%;
height: auto;
}
}
/*
##Device = Most of the Smartphones Mobiles (Portrait)
##Screen = B/w 320px to 479px
*/
@media (min-width: 320px) and (max-width: 480px) {
.profileholder{
width:100%;
height: auto;
}
/* ProfileHolder Ends Here */
/* Profile Content Card And Container */
.ProfileContent{
width: 100%;
height: auto;
}
}
<html>
<head>
<title>Responsive Profile</title>
<link rel="stylesheet" type="text/css" href="..\Styles\profile.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"><!-- Bootstrap CDN Font-awesome -->
</head>
<body>
<!-- Bootstrap Jquery JavaScripts -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script><!-- Bootstrap Jquery JavaScripts -->
<div class="row">
<div class="col-sm-6">
<div class="container">
<br>
<div class="card profileholder">
<img class="card-img-top ProfileAvatar" src="..\upload\tmp\img.jpg" alt="alt"></img>
<div class="card-body">
<h4 class="card-title holderTitle">الإسم</h4><br><br>
<a name="PMbutton" id="private" class="btn btn-danger btn-block messagebtn" href="#" role="button">رسالة</a>
<a name="d" id="ds" class="btn btn-dark btn-block messagebtn" href="#" role="button">متابعة</a>
<i class="fas fa-map-marker-alt fas-3x" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
<div class="col-sm-auto">
<br>
<div class="card ProfileContent">
<div class="card-body">
Content Here tab panel....etc
</div>
</div>
</div>
</div>
</body>
至少最重要的是 col-sm-auto
【问题讨论】:
标签: html css twitter-bootstrap