text-align属性在此代码中无法正常工作

时间:2016-08-22 07:47:58

标签: html css

在此代码中,类" robin"上的text-align属性没有正常工作。我想把图标变成中心。但所有这些都打印在同一行。

     <div id="good">
            <div id="vahid">
                <div id="one">

                    <div id="fizz"><img src="image1.jpg"></div><br><br><br>
                    <!--<<br><br>

                   <br><br> br><br>-->
                    <!--icons-->

                            <!--<img  class="render" src="icona.png">
                            <img  src="iconb.png">
                            <img  class="render" src="iconc.png">
                            <img  class="render" src="icond.png">-->
                            <i class="robin fa fa-glass"> </i>
                            <i class="robin fa fa-th"> </i>
                            <i class="robin fa fa-th-large"> </i>
                            <i class="robin fa fa-align-justify"> </i>
                            <br>
                       <br><br><br><br>
                        <!--<span class="local">
                            <img src="img4.jpg">
                            <img src="img5.jpg">
                            <img src="img6.jpg">
                            <img src="img7.jpg">
                        </span>-->
                </div>
            </div>
            <div id="isnani">
                 <div id="third">
                    <p >
                        <span class="fourth">Dashboard</span>      
                        <span class="fifth">  + New</span>
                    </p>
                     <!--button-->

                    <img src="left.jpg"  onclick="myFunction()" id="button">
                    <!--<p class="fourth">&nbsp;</p>
                    <p id="fort"><input type="text" placeholder="search your project here..." ></p>
                    <div id="jump"><img  src="search.jpg" height="20px" width="10px"></div>-->

                    <p id="sixth">    Welcome to Flatkit</p>
                    <p id="seventh"> Bootstrap 4 Web App Kit With Angular js</p>


                </div>
            </div>
        </div>

关联的css:

#good{
    width: 100%;
    height: 100%;
}
#vahid{
    float: left;
    width: 6%;
    height: 100%;
    background-color: #1f1f7a;
}
#isnani{
    float: left;
    width: 93%;
    height: 100%;
    background-color: bisque;
}
#one {
  display:block;
  background-color: #1f1f7a ;
   /* width:60px;
    height: 867px;*/
}
#boom{
    margin-top: 30%;
    height: 25px;
    width: 35px;
    float: left;
    margin-left: auto;
    margin-right: auto;
    display: block;
    /* padding-left: 20px;
   margin-left: auto;
    margin-right: auto;*/


 }
 /* .local{
margin-top: 30%;
width: 100%;
text-align:center;
}*/
.local img{
 display: table;
 height: 1.75%;
 width:20%;
 margin-top: 30%;
 margin-left: auto;
 margin-right: auto;
 /*width:20%;*/
}

/*.local img {
    height: 1.75%;
    width:20%;
    margin :30% 0% 10% 40%;
}*/

/*isnani starts here*/
#third{  float:left;
    width:100%;
     height: 15%;
    border-color:white; 
border-style : solid;
background-color : white;

}
.fourth{
    margin-left: 2%;
    margin-top: 5%;
    font-family: sans-serif;

}
.fifth{
    color: #808080;
    font-size: 80%;
    font-weight: 800;
    font-family: arial,sans-serif;
    margin-left: 1%;

}
#sixth{
     font-family: sans-serif;
     font-size:150%;
    color:#666666;
    margin-top: 4%;
    margin-left: 2%;
    /*top: -2%;/
   /* line-height: 3%; */


 }
 #seventh{
    position: absolute;
     top: 11%;
    color: #808080;
    font-family: sans-serif;
    font-size: 80%;
    margin-left: 1.8%;
    margin-top: 1.5%;

    /*line-height: 3%;*/

}

#button{
    float:left;
    margin-left: -0.8%;
    width: 1.5%;
    hyphens: 20%;
}
li a{
    text-decoration: none;
}
.parent li{
    list-style-type: none;
    display: none;
    text-decoration: none;
}
#bad .parent{
    cursor: pointer;
    font-family: sans-serif;
    line-height: 200%;


}
#bad{

    background-color:  #1f1f7a;
        width: 15%;

    height: 100%;
    color: white;
 }
 /* #bad .parent {
    height: 100%;
    width: 100%;
    display: block;
    cursor: pointer;
    line-height: 3%;
    height: 30px;
    background: #023b3b;
    color: white;
    text-align: center;
 }*/
 #pappaya {
    background-color: #1f1f7a;
    width: 180%;
    margin-left: -28%;
    padding-left: 38%;
    padding-right: 40%;
    width: 50%;
    /*text-align: center;
    margin-right:122%;*/
 }
 #pappayas {
        /*background-color:#339933;
         width: 100%;
    margin-left: -50%;
    padding-left: 50%;*/
    background-color:#339933;
    width: 180%;
    margin-left: -28%;
    padding-left: 38%;
    padding-right: 40%;
    width: 50%;

    }
#pappaya li a
{
    color: white;
}
 #pappayas li a
{
    color: white;
}
#pappaya li:hover{
    background-color: #122112;
    color: white;
    width: 184%;
    margin-left: -75%;
    padding-left: 70%;
}
#pappaya li a:hover{
    color: white;

}
#pappayas li:hover{
    /*text-align: center;*/
    background-color: #122112;
    color: white;
    width: 184%;
    margin-left: -75%;
    padding-left: 70%;
}
#pappayas li a:hover{
    color: white;

}

#bad{
     padding-top: 1%;
    background-color:  #1f1f7a;
        width: 15%;

    height: 100%;
    color: white;
    position: absolute;
    top: 0%;
    display: none;
 }
 #bad .parent:hover
 {
    background-color: #122112;
    color: white;
    width: 78%;
}
#bad ul:hover{
    background-color: #122112;}
/*#bad .parent:hover ~ .parent img{
    width: 13%;
    height: 3%;
}*/
 /* #bad .parent:hover img{
width: 13%;
height: 3%;
}*/
#bad .parent:hover > img {
width: 18%;
height: 3%;
}


/*new setup*/
#boa{
    padding-left: 5%;
    height: 5%;
    width: 20%;
    float: left;

}
.bob{
    text-indent: 200%;
    margin-top: 210%;
    font-size: 150%;
    font-family: sans-serif;
    color: white;
    font-weight: bold;

 }
 #buttnsec{
     margin-left: 94%;
        width: 10%;
        hyphens: 20%;
}
.boc{
    text-indent: 4%;
    color : bisque;
    font-size: 83%;
    font-family: sans-serif;

    font-weight:70% ;
    margin-left: 7%;
}
.parent img{
    float: left;
    width: 15%;
    height: 3%;
    margin-left: -12%;
    margin-right: 20%;
}
#drop{
float:right;
height: 2%;
padding-top: 5%;

}
.render{
-webkit-filter: invert(100%); /* Safari/Chrome */
filter: invert(100%);
}
/*#bad .parent :hover{
     background: #122112;
}*/
.robin{
    color: white;
    margin-top: 25%;
   /* margin-left: 25%;
    margin-right: 25%;*/
    text-align: center;

}
#fizz{
margin-top: 30%;
width: 100%;
text-align:center;
}
#fizz img{ 
width:50%;
}  

在此代码中,类&#34; robin&#34;上的text-align属性没有正常工作。我想将图标设置为centre.but所有这些都打印在同一行。

3 个答案:

答案 0 :(得分:2)

...堆叠

&#13;
&#13;
p.icons { text-align: center;  padding: 0 3px;}

#good{
    width: 100%;
    height: 100%;
}
#vahid{
    float: left;
    width: 6%;
    height: 100%;
    background-color: #1f1f7a;
}
#isnani{
    float: left;
    width: 93%;
    height: 100%;
    background-color: bisque;
}
#one {
  display:block;
  background-color: #1f1f7a ;
   /* width:60px;
    height: 867px;*/
}
#boom{
    margin-top: 30%;
    height: 25px;
    width: 35px;
    float: left;
    margin-left: auto;
    margin-right: auto;
    display: block;
    /* padding-left: 20px;
   margin-left: auto;
    margin-right: auto;*/


 }
 /* .local{
margin-top: 30%;
width: 100%;
text-align:center;
}*/
.local img{
 display: table;
 height: 1.75%;
 width:20%;
 margin-top: 30%;
 margin-left: auto;
 margin-right: auto;
 /*width:20%;*/
}

/*.local img {
    height: 1.75%;
    width:20%;
    margin :30% 0% 10% 40%;
}*/

/*isnani starts here*/
#third{  float:left;
    width:100%;
     height: 15%;
    border-color:white; 
border-style : solid;
background-color : white;

}
.fourth{
    margin-left: 2%;
    margin-top: 5%;
    font-family: sans-serif;

}
.fifth{
    color: #808080;
    font-size: 80%;
    font-weight: 800;
    font-family: arial,sans-serif;
    margin-left: 1%;

}
#sixth{
     font-family: sans-serif;
     font-size:150%;
    color:#666666;
    margin-top: 4%;
    margin-left: 2%;
    /*top: -2%;/
   /* line-height: 3%; */


 }
 #seventh{
    position: absolute;
     top: 11%;
    color: #808080;
    font-family: sans-serif;
    font-size: 80%;
    margin-left: 1.8%;
    margin-top: 1.5%;

    /*line-height: 3%;*/

}

#button{
    float:left;
    margin-left: -0.8%;
    width: 1.5%;
    hyphens: 20%;
}
li a{
    text-decoration: none;
}
.parent li{
    list-style-type: none;
    display: none;
    text-decoration: none;
}
#bad .parent{
    cursor: pointer;
    font-family: sans-serif;
    line-height: 200%;


}
#bad{

    background-color:  #1f1f7a;
        width: 15%;

    height: 100%;
    color: white;
 }
 /* #bad .parent {
    height: 100%;
    width: 100%;
    display: block;
    cursor: pointer;
    line-height: 3%;
    height: 30px;
    background: #023b3b;
    color: white;
    text-align: center;
 }*/
 #pappaya {
    background-color: #1f1f7a;
    width: 180%;
    margin-left: -28%;
    padding-left: 38%;
    padding-right: 40%;
    width: 50%;
    /*text-align: center;
    margin-right:122%;*/
 }
 #pappayas {
        /*background-color:#339933;
         width: 100%;
    margin-left: -50%;
    padding-left: 50%;*/
    background-color:#339933;
    width: 180%;
    margin-left: -28%;
    padding-left: 38%;
    padding-right: 40%;
    width: 50%;

    }
#pappaya li a
{
    color: white;
}
 #pappayas li a
{
    color: white;
}
#pappaya li:hover{
    background-color: #122112;
    color: white;
    width: 184%;
    margin-left: -75%;
    padding-left: 70%;
}
#pappaya li a:hover{
    color: white;

}
#pappayas li:hover{
    /*text-align: center;*/
    background-color: #122112;
    color: white;
    width: 184%;
    margin-left: -75%;
    padding-left: 70%;
}
#pappayas li a:hover{
    color: white;

}

#bad{
     padding-top: 1%;
    background-color:  #1f1f7a;
        width: 15%;

    height: 100%;
    color: white;
    position: absolute;
    top: 0%;
    display: none;
 }
 #bad .parent:hover
 {
    background-color: #122112;
    color: white;
    width: 78%;
}
#bad ul:hover{
    background-color: #122112;}
/*#bad .parent:hover ~ .parent img{
    width: 13%;
    height: 3%;
}*/
 /* #bad .parent:hover img{
width: 13%;
height: 3%;
}*/
#bad .parent:hover > img {
width: 18%;
height: 3%;
}


/*new setup*/
#boa{
    padding-left: 5%;
    height: 5%;
    width: 20%;
    float: left;

}
.bob{
    text-indent: 200%;
    margin-top: 210%;
    font-size: 150%;
    font-family: sans-serif;
    color: white;
    font-weight: bold;

 }
 #buttnsec{
     margin-left: 94%;
        width: 10%;
        hyphens: 20%;
}
.boc{
    text-indent: 4%;
    color : bisque;
    font-size: 83%;
    font-family: sans-serif;

    font-weight:70% ;
    margin-left: 7%;
}
.parent img{
    float: left;
    width: 15%;
    height: 3%;
    margin-left: -12%;
    margin-right: 20%;
}
#drop{
float:right;
height: 2%;
padding-top: 5%;

}
.render{
-webkit-filter: invert(100%); /* Safari/Chrome */
filter: invert(100%);
}
/*#bad .parent :hover{
     background: #122112;
}*/
.robin{
    color: white;
    margin-top: 25%;
   /* margin-left: 25%;
    margin-right: 25%;*/
    text-align: center;

}
#fizz{
margin-top: 30%;
width: 100%;
text-align:center;
}
#fizz img{ 
width:50%;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>

<div id="good">
            <div id="vahid">
                <div id="one">

                    <div id="fizz"><img src="image1.jpg"></div>  <div id="fizz"><img src="image1.jpg"></div>
                      <p class="icons">
                            <i class="robin fa fa-glass"></i>
                            <i class="robin fa fa-th"></i>
                            <i class="robin fa fa-th-large"></i>
                            <i class="robin fa fa-align-justify"></i>
                       </p>
                </div>
            </div>
            <div id="isnani">
                 <div id="third">
                    <p >
                        <span class="fourth">Dashboard</span>      
                        <span class="fifth">  + New</span>
                    </p>
                     <!--button-->

                    <img src="left.jpg"  onclick="myFunction()" id="button">
                    <!--<p class="fourth">&nbsp;</p>
                    <p id="fort"><input type="text" placeholder="search your project here..." ></p>
                    <div id="jump"><img  src="search.jpg" height="20px" width="10px"></div>-->

                    <p id="sixth">    Welcome to Flatkit</p>
                    <p id="seventh"> Bootstrap 4 Web App Kit With Angular js</p>


                </div>
            </div>
        </div>
&#13;
&#13;
&#13;

您不需要那么多的break标签。只需使用一个段落并将其设置为文本对齐中心。图标将落实到位,您不需要一堆周围的br标记。

或者在同一条线上......

&#13;
&#13;
p.icons { text-align: center;  padding: 0 3px;}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>


                <div id="one">

                    <div id="fizz"><img src="image1.jpg"></div>
                      <p class="icons">
                            <i class="robin fa fa-glass"></i>
                            <i class="robin fa fa-th"></i>
                            <i class="robin fa fa-th-large"></i>
                            <i class="robin fa fa-align-justify"></i>
                       </p>
                </div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

.robin class ...

中试用此代码

.robin{
    color: white;
    margin-top: 25%;
    margin-left: auto;
    margin-right: auto;
    display:table;

}

答案 2 :(得分:0)

试试这个

def doStuff() = {
  val input: RDD[(String,List[(String,String,String,String)])] = sc.parallelize(Seq(
    ("600",List(("5","111","1","1"), ("15","111","1","5"), ("38","111","2",null))),
    ("700",List(("5","111","1","1"), ("35","111","1","5"), ("39","111","2",null)))
  ))

  def splitList(l: List[(String,String,String,String)]): Iterable[List[(String,String,String,String)]] = {
    l.groupBy(_._1.toInt / 20).values // or any other logic
  }

  val result = input.flatMap { case (k, l) => splitList(l).map(sublist => (k, sublist)) }

  result.foreach(println)
  // prints: 
  // (600,List((38,111,2,null)))
  // (600,List((5,111,1,1), (15,111,1,5)))
  // (700,List((35,111,1,5), (39,111,2,null)))
  // (700,List((5,111,1,1)))
}

.robin.fa{display:block;}
#good{
    width: 100%;
    height: 100%;
}
#vahid{
    float: left;
    width: 6%;
    height: 100%;
    background-color: #1f1f7a;
}
#isnani{
    float: left;
    width: 93%;
    height: 100%;
    background-color: bisque;
}
#one {
  display:block;
  background-color: #1f1f7a ;
   /* width:60px;
    height: 867px;*/
}
#boom{
    margin-top: 30%;
    height: 25px;
    width: 35px;
    float: left;
    margin-left: auto;
    margin-right: auto;
    display: block;
    /* padding-left: 20px;
   margin-left: auto;
    margin-right: auto;*/


 }
 /* .local{
margin-top: 30%;
width: 100%;
text-align:center;
}*/
.local img{
 display: table;
 height: 1.75%;
 width:20%;
 margin-top: 30%;
 margin-left: auto;
 margin-right: auto;
 /*width:20%;*/
}

/*.local img {
    height: 1.75%;
    width:20%;
    margin :30% 0% 10% 40%;
}*/

/*isnani starts here*/
#third{  float:left;
    width:100%;
     height: 15%;
    border-color:white; 
border-style : solid;
background-color : white;

}
.fourth{
    margin-left: 2%;
    margin-top: 5%;
    font-family: sans-serif;

}
.fifth{
    color: #808080;
    font-size: 80%;
    font-weight: 800;
    font-family: arial,sans-serif;
    margin-left: 1%;

}
#sixth{
     font-family: sans-serif;
     font-size:150%;
    color:#666666;
    margin-top: 4%;
    margin-left: 2%;
    /*top: -2%;/
   /* line-height: 3%; */


 }
 #seventh{
    position: absolute;
     top: 11%;
    color: #808080;
    font-family: sans-serif;
    font-size: 80%;
    margin-left: 1.8%;
    margin-top: 1.5%;

    /*line-height: 3%;*/

}

#button{
    float:left;
    margin-left: -0.8%;
    width: 1.5%;
    hyphens: 20%;
}
li a{
    text-decoration: none;
}
.parent li{
    list-style-type: none;
    display: none;
    text-decoration: none;
}
#bad .parent{
    cursor: pointer;
    font-family: sans-serif;
    line-height: 200%;


}
#bad{

    background-color:  #1f1f7a;
        width: 15%;

    height: 100%;
    color: white;
 }
 /* #bad .parent {
    height: 100%;
    width: 100%;
    display: block;
    cursor: pointer;
    line-height: 3%;
    height: 30px;
    background: #023b3b;
    color: white;
    text-align: center;
 }*/
 #pappaya {
    background-color: #1f1f7a;
    width: 180%;
    margin-left: -28%;
    padding-left: 38%;
    padding-right: 40%;
    width: 50%;
    /*text-align: center;
    margin-right:122%;*/
 }
 #pappayas {
        /*background-color:#339933;
         width: 100%;
    margin-left: -50%;
    padding-left: 50%;*/
    background-color:#339933;
    width: 180%;
    margin-left: -28%;
    padding-left: 38%;
    padding-right: 40%;
    width: 50%;

    }
#pappaya li a
{
    color: white;
}
 #pappayas li a
{
    color: white;
}
#pappaya li:hover{
    background-color: #122112;
    color: white;
    width: 184%;
    margin-left: -75%;
    padding-left: 70%;
}
#pappaya li a:hover{
    color: white;

}
#pappayas li:hover{
    /*text-align: center;*/
    background-color: #122112;
    color: white;
    width: 184%;
    margin-left: -75%;
    padding-left: 70%;
}
#pappayas li a:hover{
    color: white;

}

#bad{
     padding-top: 1%;
    background-color:  #1f1f7a;
        width: 15%;

    height: 100%;
    color: white;
    position: absolute;
    top: 0%;
    display: none;
 }
 #bad .parent:hover
 {
    background-color: #122112;
    color: white;
    width: 78%;
}
#bad ul:hover{
    background-color: #122112;}
/*#bad .parent:hover ~ .parent img{
    width: 13%;
    height: 3%;
}*/
 /* #bad .parent:hover img{
width: 13%;
height: 3%;
}*/
#bad .parent:hover > img {
width: 18%;
height: 3%;
}


/*new setup*/
#boa{
    padding-left: 5%;
    height: 5%;
    width: 20%;
    float: left;

}
.bob{
    text-indent: 200%;
    margin-top: 210%;
    font-size: 150%;
    font-family: sans-serif;
    color: white;
    font-weight: bold;

 }
 #buttnsec{
     margin-left: 94%;
        width: 10%;
        hyphens: 20%;
}
.boc{
    text-indent: 4%;
    color : bisque;
    font-size: 83%;
    font-family: sans-serif;

    font-weight:70% ;
    margin-left: 7%;
}
.parent img{
    float: left;
    width: 15%;
    height: 3%;
    margin-left: -12%;
    margin-right: 20%;
}
#drop{
float:right;
height: 2%;
padding-top: 5%;

}
.render{
-webkit-filter: invert(100%); /* Safari/Chrome */
filter: invert(100%);
}
/*#bad .parent :hover{
     background: #122112;
}*/
.robin{
    color: white;
    margin-top: 25%;
   /* margin-left: 25%;
    margin-right: 25%;*/
    text-align: center;

}
#fizz{
margin-top: 30%;
width: 100%;
text-align:center;
}
#fizz img{ 
width:50%;
} 
.robin.fa{display:block;}