且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

breadcrumb与bootstrap我想让它响应

更新时间:2023-11-05 17:13:22

使用媒体查询并撰写所需的CSS。



下面列出了不同的断点(来源

  / *智能手机--------- * / 

@media only screen and(min-device-width:320px)and(max-device-width:480px){
/ *样式* /
}
/ *智能手机(横向)----------- * /

@media只有屏幕和(最小宽度:321像素){
/ * Stylees * /
}
/ *智能手机(肖像)----------- * /

@media screen and(max-width:320px){
/ * Styles * /
}
/ * iPads(纵向和横向)----------- * /

@media only screen and(min-device-width:768px)and(max-device-width:1024px){
/ * Styles * /
}
/ * iPads(横向)----------- * /

@media only screen and(min-device-width:768px)and(max-device-width:1024px )和(orientation:landscape){
/ *样式* /
}
/ * iPads(portrait)----------- * /

@media only screen and(min-device-width:768px)and(max-device-width:1024px)and(orientation:portrait){
/ * Styles * /
}
/ **********
iPad 3
********** /

@media只有屏幕和(min- device-width:768px)and(max-device-width:1024px)and(orientation:landscape)and(-webkit-min-device-pixel-ratio:2){
/ * Styles * /
}
@media only screen and(min-device-width:768px)and(max-device-width:1024px)and(orientation:portrait)and(-webkit-min-device-pixel-ratio:2 ){
/ *样式* /
}
/ *台式机和笔记本电脑----------- * /

@media和(min-width:1224px){
/ *样式* /
}
/ *大屏幕----------- * /

@media only screen and(min-width:1824px){
/ * Styles * /
}
/ * iPhone 4 ----------- *

@media only screen and(min-device-width:320px)and(max-device-width:480px)and(orientation:landscape)and(-webkit-min-device-pixel- :2){
/ * Styles * /
}
@media only screen and(min-device-width:320px)and(max-device-width:480px)and(orientation:肖像)和(-webkit-min-device-pixel-ratio:2){
/ *样式* /
}
/ * iPhone 5 ---------- - * /

@media only screen and(min-device-width:320px)and(max-device-height:568px)and(orientation:landscape)and(-webkit-device-pixel- ratio:2){
/ * Styles * /
}
@media only screen and(min-device-width:320px)and(max-device-height:568px)and :portrait)and(-webkit-device-pixel-ratio:2){
/ * Styles * /
}
/ * iPhone 6 ----------- * /

@media only screen and(min-device-width:375px)and(max-device-height:667px)and(orientation:landscape)and(-webkit-device-pixel-ratio :2){
/ * Styles * /
}
@media only screen and(min-device-width:375px)and(max-device-height:667px)and肖像)和(-webkit-device-pixel-ratio:2){
/ *样式* /
}
/ * iPhone 6+ ----------- * /

@media only screen and(min-device-width:414px)and(max-device-height:736px)and(orientation:landscape)and(-webkit-device-pixel-ratio :2){
/ * Styles * /
}
@media only screen and(min-device-width:414px)and(max-device-height:736px)and 3)三星Galaxy S3 ----------- - - - - - - - - - - - - - - - - * /

@media only screen and(min-device-width:320px)and(max-device-height:640px)and(orientation:landscape)and(-webkit-device-pixel-ratio :2){
/ * Styles * /
}
@media only screen and(min-device-width:320px)and(max-device-height:640px)and(orientation:肖像)和(-webkit设备像素比:2){
/ *风格* /
}
/ *三星Galaxy S4 ----------- * /

@media only screen and(min-device-width:320px)and(max-device-height:640px)and(orientation:landscape)and(-webkit-device-pixel-ratio :3){
/ * Styles * /
}
@media only screen and(min-device-width:320px)and(max-device-height:640px)and(orientation: 3){
/ *样式* /
}
/ *三星Galaxy S5 ----------- * /

@media only screen and(min-device-width:360px)and(max-device-height:640px)and(orientation:landscape)and(-webkit-device-pixel-ratio :3){
/ * Styles * /
}
@media only screen and(min-device-width:360px)and(max-device-height:640px)and(orientation:肖像)和(-webkit-device-pixel-ratio:3){
/ *样式* /
}


I want to make this bradcrumb responsive with the all sizes i don't know if it can but i am tried but not reach to result can you help me i am fresher on bootstrap , this is the css for the breadcrumb .

/*----------------------------start-----breadcrumb----------------------------------*/

.breadcrumbb {
  /*centering*/
  display: inline-block;
  box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.35);
  /*width: 757px;*/
  overflow: hidden;
  border-radius: 5px;
  -ms-border-radius: 5px;
  /*Lets add the numbers for each link using CSS counters. flag is the name of the counter. to be defined using counter-reset in the parent element of the links*/
  counter-reset: flag;
}
.breadcrumbb a {
  /*width: 80px;*/
  text-align: left;
  cursor: context-menu;
  text-decoration: none;
  outline: none;
  display: block;
  float: left;
  font-size: 12px;
  line-height: 36px;
  color: white;
  /*need more margin on the left of links to accomodate the numbers*/
  padding: 0 10px 0 60px;
  /*background: #666;*/
  /*background: linear-gradient(#b89470, #b89470);
    background: -ms-linear-gradient(top, #b89470, #b89470); /* IE 11 */
  background: #dfdfdf;
  /* Old browsers */
  background: -moz-linear-gradient(left, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* FF3.6+ */
  background: -webkit-gradient(linear, left top, right top, color-stop(0%, #dfdfdf), color-stop(0%, #dfdfdf), color-stop(0%, #dfdfdf), color-stop(100%, #dfdfdf));
  /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(left, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(left, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* Opera 11.10+ */
  background: -ms-linear-gradient(left, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* IE10+ */
  background: linear-gradient(to right, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* W3C */
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf ', endColorstr='#dfdfdf ', GradientType=1);
  /* IE6-9 */
  position: relative;
}
/*since the first link does not have a triangle before it we can reduce the left padding to make it look consistent with other links*/

.breadcrumbb a:first-child {
  padding-left: 46px;
  border-radius: 5px 0 0 5px;
  /*to match with the parent's radius*/
  padding-right: 20px;
}
.breadcrumbb a:first-child:before {
  left: 14px;
  text-align: center;
}
.breadcrumbb a:last-child {
  border-radius: 0 5px 5px 0;
  /*this was to prevent glitches on hover*/
  padding-right: 20px;
}
/*hover/active styles*/

.breadcrumbb a.active {
  /*background: #333;*/
  /*background: linear-gradient(#5c3d1f, #5c3d1f);
    background: -ms-linear-gradient(top, #5c3d1f, #5c3d1f); /* IE 11 */
  background: #6b93b7;
  /* Old browsers */
  background: -moz-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* FF3.6+ */
  background: -webkit-gradient(linear, left top, right top, color-stop(0%, #6b93b7), color-stop(0%, #6b93b7), color-stop(0%, #6b93b7), color-stop(100%, #6b93b7));
  /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* Opera 11.10+ */
  background: -ms-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* IE10+ */
  background: linear-gradient(to right, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* W3C */
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#6b93b7 ', endColorstr='#6b93b7 ', GradientType=1);
  /* IE6-9 */
}
.breadcrumbb a.active:after {
  /*background: #333;*/
  /*background: linear-gradient(135deg, #5c3d1f, #5c3d1f);
    background: -ms-linear-gradient(top, #5c3d1f, #5c3d1f); /* IE 11 */
  background: #6b93b7;
  /* Old browsers */
  background: -moz-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* FF3.6+ */
  background: -webkit-gradient(linear, left top, right top, color-stop(0%, #6b93b7), color-stop(0%, #6b93b7), color-stop(0%, #6b93b7), color-stop(100%, #6b93b7));
  /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* Opera 11.10+ */
  background: -ms-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* IE10+ */
  background: linear-gradient(to right, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* W3C */
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#6b93b7', endColorstr='#6b93b7', GradientType=1);
  /* IE6-9 */
}
/*adding the arrows for the breadcrumbs using rotated pseudo elements*/

.breadcrumbb a:after {
  content: '';
  position: absolute;
  top: 0;
  right: -18px;
  /*half of square's length*/
  /*same dimension as the line-height of .breadcrumb a */
  width: 36px;
  height: 36px;
  /*as you see the rotated square takes a larger height. which makes it tough to position it properly. So we are going to scale it down so that the diagonals become equal to the line-height of the link. We scale it to 70.7% because if square's: 
	length = 1; diagonal = (1^2 + 1^2)^0.5 = 1.414 (pythagoras theorem)
	if diagonal required = 1; length = 1/1.414 = 0.707*/
  transform: scale(0.707) rotate(45deg);
  /*we need to prevent the arrows from getting buried under the next link*/
  z-index: 1;
  /*background same as links but the gradient will be rotated to compensate with the transform applied*/
  /*background: #666;*/
  /*background: linear-gradient(135deg, #b89470, #b89470);
    background: -ms-linear-gradient(top, #b89470, #b89470); /* IE 11 */
  background: #dfdfdf;
  /* Old browsers */
  background: -moz-linear-gradient(left, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* FF3.6+ */
  background: -webkit-gradient(linear, left top, right top, color-stop(0%, #dfdfdf), color-stop(0%, #dfdfdf), color-stop(0%, #dfdfdf), color-stop(100%, #dfdfdf));
  /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(left, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(left, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* Opera 11.10+ */
  background: -ms-linear-gradient(left, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* IE10+ */
  background: linear-gradient(to right, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 0%, #dfdfdf 100%);
  /* W3C */
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#dfdfdf', GradientType=1);
  /* IE6-9 */
  /*stylish arrow design using box shadow*/
  box-shadow: 2px -2px 0 2px rgba(0, 0, 0, 0.4), 3px -3px 0 2px rgba(255, 255, 255, 0.1);
  /*
		5px - for rounded arrows and 
		50px - to prevent hover glitches on the border created using shadows*/
  border-radius: 0 5px 0 50px;
  -webkit-border-radius: 0 5px 0 50px;
}
/*we dont need an arrow after the last link*/

.breadcrumbb a:last-child:after {
  content: none;
}
.notcount {
  color: #5c3d1f;
  font-size: 13px;
}
/*we will use the :before element to show numbers*/

.breadcrumbb a:before {
  content: counter(flag);
  counter-increment: flag;
  /*some styles now*/
  border-radius: 100%;
  -webkit-border-radius: 100%;
  text-align: center;
  /*-webkit-border-radius: 100%;
    -moz-border-radius: 100%;
    border-radius: 100%;*/
  width: 20px;
  height: 20px;
  line-height: 20px;
  margin: 8px 0;
  position: absolute;
  top: 0;
  left: 30px;
  /*background: #444;*/
  /*background: linear-gradient(#5c3d1f, #5c3d1f);
    background: -ms-linear-gradient(top, #5c3d1f, #5c3d1f); /* IE 11*/
  background: #6b93b7;
  /* Old browsers */
  background: -moz-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* FF3.6+ */
  background: -webkit-gradient(linear, left top, right top, color-stop(0%, #6b93b7), color-stop(0%, #6b93b7), color-stop(0%, #6b93b7), color-stop(100%, #6b93b7));
  /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* Opera 11.10+ */
  background: -ms-linear-gradient(left, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* IE10+ */
  background: linear-gradient(to right, #6b93b7 0%, #6b93b7 0%, #6b93b7 0%, #6b93b7 100%);
  /* W3C */
  filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#6b93b7', endColorstr='#6b93b7', GradientType=1);
  /* IE6-9 */
  font-weight: bold;
}
.flat a,
.flat a:after {
  background: white;
  color: black;
  transition: all 0.5s;
}
.flat a:before {
  background: white;
  box-shadow: 0 0 0 1px #ccc;
}
.flat a:hover,
.flat a.active,
.flat a:hover:after,
.flat a.active:after {
  background: #9EEB62;
}
/*----------------------------End-----breadcrumb----------------------------------*/

<div class="col-xs-10 col-sm-8 col-md-8 col-lg-8" style="background-color: #dfdfdf; padding: 6px 27px 20px 27px;">
  <div class="row">
    <div class="col-xs-12 col-sm-11 col-md-11 col-lg-11">
      <div class="breadcrumbb" style="position: relative; top: -2px;">
        <a href="#" style="" class="active">Select</a>
        <a href="#" style="">Add services</a>
        <a href="#" style="">Login</a>
        <a href="#" style="">Summary</a>
        <a href="#" style="">Confirmation</a>
      </div>
    </div>
  </div>
</div>

Use Media Queries and write the required CSS.

Different breakpoints are listed below (Source)

/* Smartphones (portrait and landscape) ----------- */

@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
  /* Styles */
}
/* Smartphones (landscape) ----------- */

@media only screen and (min-width: 321px) {
  /* Styles */
}
/* Smartphones (portrait) ----------- */

@media only screen and (max-width: 320px) {
  /* Styles */
}
/* iPads (portrait and landscape) ----------- */

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
  /* Styles */
}
/* iPads (landscape) ----------- */

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
  /* Styles */
}
/* iPads (portrait) ----------- */

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) {
  /* Styles */
}
/**********
iPad 3
**********/

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) {
  /* Styles */
}
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) {
  /* Styles */
}
/* Desktops and laptops ----------- */

@media only screen and (min-width: 1224px) {
  /* Styles */
}
/* Large screens ----------- */

@media only screen and (min-width: 1824px) {
  /* Styles */
}
/* iPhone 4 ----------- */

@media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) {
  /* Styles */
}
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) {
  /* Styles */
}
/* iPhone 5 ----------- */

@media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2) {
  /* Styles */
}
@media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2) {
  /* Styles */
}
/* iPhone 6 ----------- */

@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2) {
  /* Styles */
}
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2) {
  /* Styles */
}
/* iPhone 6+ ----------- */

@media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2) {
  /* Styles */
}
@media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2) {
  /* Styles */
}
/* Samsung Galaxy S3 ----------- */

@media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2) {
  /* Styles */
}
@media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2) {
  /* Styles */
}
/* Samsung Galaxy S4 ----------- */

@media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 3) {
  /* Styles */
}
@media only screen and (min-device-width: 320px) and (max-device-height: 640px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 3) {
  /* Styles */
}
/* Samsung Galaxy S5 ----------- */

@media only screen and (min-device-width: 360px) and (max-device-height: 640px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 3) {
  /* Styles */
}
@media only screen and (min-device-width: 360px) and (max-device-height: 640px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 3) {
  /* Styles */
}