Home Web Front-end HTML Tutorial 博客美化(三):手机完美浏览博客 - 六月天空的芬芳

博客美化(三):手机完美浏览博客 - 六月天空的芬芳

May 20, 2016 pm 01:48 PM

本文参考吕大豹的博客

博客园在手机端的浏览效果并不是很好,所以我们来通过两步来修改一下

第一步:

在页首html代码中添加js代码

<span style="color: #008080;">1</span> <script>
<span style="color: #008080;">2 <span style="color: #0000ff;">var content = 'width=device-width, initial-scale=1 user-scalable=no'<span style="color: #000000;">;
<span style="color: #008080;">3 <span style="color: #0000ff;">var viewport = document.createElement('meta'<span style="color: #000000;">);
<span style="color: #008080;">4 viewport.setAttribute('name', 'viewport'<span style="color: #000000;">);
<span style="color: #008080;">5 viewport.setAttribute('content'<span style="color: #000000;">, content);
<span style="color: #008080;">6 <span style="color: #000000;">document.head.appendChild( viewport );
<span style="color: #008080;">7 </script>
Copy after login

第二步:

修改css代码

可以使用谷歌浏览器f12进行手机模式的浏览,然后再进行修改

<span style="color: #008080;">1</span> <span style="color: #800000;">@media screen and (max-width: 768px)</span>{
<span style="color: #008080;">2</span> 
<span style="color: #008080;">3</span>             <span style="color: #008000;">/*</span><span style="color: #008000;">手机显示css代码</span><span style="color: #008000;">*/</span>
<span style="color: #008080;">4</span> 
<span style="color: #008080;">5</span> }        
Copy after login

由于模板的不同所以css代码也就不同,贴出我自己的代码让大家参考一下

<span style="color: #008080;">  1</span> <span style="color: #800000;">@media screen and (max-width: 768px)</span>{
<span style="color: #008080;">  2</span> 
<span style="color: #008080;">  3</span> <span style="color: #ff0000;">  #main
</span><span style="color: #008080;">  4</span> <span style="color: #ff0000;">  {
</span><span style="color: #008080;">  5</span> <span style="color: #ff0000;">  min-width</span>:<span style="color: #0000ff;"> 300px</span>;
<span style="color: #008080;">  6</span> <span style="color: #ff0000;">  padding-right</span>:<span style="color: #0000ff;"> 10px</span>;
<span style="color: #008080;">  7</span> 
<span style="color: #008080;">  8</span>   }
<span style="color: #008080;">  9</span> <span style="color: #800000;"> #mainContent .forFlow</span>{
<span style="color: #008080;"> 10</span> <span style="color: #ff0000;">    margin-left</span>:<span style="color: #0000ff;">20em</span>;
<span style="color: #008080;"> 11</span> <span style="color: #ff0000;">    float</span>:<span style="color: #0000ff;"> none</span>; 
<span style="color: #008080;"> 12</span> <span style="color: #ff0000;">    width</span>:<span style="color: #0000ff;"> auto</span>;
<span style="color: #008080;"> 13</span> <span style="color: #ff0000;">    margin-left</span>:<span style="color: #0000ff;"> 0px</span>;
<span style="color: #008080;"> 14</span> }
<span style="color: #008080;"> 15</span> 
<span style="color: #008080;"> 16</span> <span style="color: #800000;">#mainContent </span>{
<span style="color: #008080;"> 17</span> <span style="color: #ff0000;">    min-height</span>:<span style="color: #0000ff;"> 200px</span>;
<span style="color: #008080;"> 18</span> <span style="color: #ff0000;">    padding</span>:<span style="color: #0000ff;"> 0px 0px 10px 0</span>;
<span style="color: #008080;"> 19</span> <span style="color: #ff0000;">    *padding-top</span>:<span style="color: #0000ff;">10px</span>;
<span style="color: #008080;"> 20</span> <span style="color: #ff0000;">    -o-text-overflow</span>:<span style="color: #0000ff;"> ellipsis</span>;
<span style="color: #008080;"> 21</span> <span style="color: #ff0000;">    text-overflow</span>:<span style="color: #0000ff;"> ellipsis</span>;
<span style="color: #008080;"> 22</span> <span style="color: #ff0000;">    overflow</span>:<span style="color: #0000ff;"> hidden</span>;
<span style="color: #008080;"> 23</span> <span style="color: #ff0000;">    word-break</span>:<span style="color: #0000ff;"> break-all</span>;
<span style="color: #008080;"> 24</span>     
<span style="color: #008080;"> 25</span> <span style="color: #ff0000;">    float</span>:<span style="color: #0000ff;"> left</span>;
<span style="color: #008080;"> 26</span>     
<span style="color: #008080;"> 27</span> <span style="color: #ff0000;">    width</span>:<span style="color: #0000ff;"> 100%</span>;
<span style="color: #008080;"> 28</span> <span style="color: #ff0000;">    margin-left</span>:<span style="color: #0000ff;"> 0px</span>;
<span style="color: #008080;"> 29</span> <span style="color: #ff0000;">    margin-right</span>:<span style="color: #0000ff;"> 0px</span>;
<span style="color: #008080;"> 30</span> }    
<span style="color: #008080;"> 31</span> <span style="color: #800000;">#blogTitle </span>{
<span style="color: #008080;"> 32</span> <span style="color: #ff0000;">    height</span>:<span style="color: #0000ff;">90px</span>;
<span style="color: #008080;"> 33</span> <span style="color: #ff0000;">    background</span>:<span style="color: #0000ff;"> #fff</span>;
<span style="color: #008080;"> 34</span> <span style="color: #ff0000;">    clear</span>:<span style="color: #0000ff;"> both</span>;
<span style="color: #008080;"> 35</span> <span style="color: #ff0000;">    background-repeat</span>:<span style="color: #0000ff;">no-repeat</span>;
<span style="color: #008080;"> 36</span> <span style="color: #ff0000;">    background-image</span>:<span style="color: #0000ff;">url("http://files.cnblogs.com/files/itsuibi/logosmall.gif")</span>;
<span style="color: #008080;"> 37</span> }
<span style="color: #008080;"> 38</span> <span style="color: #800000;">#mainContent </span>{
<span style="color: #008080;"> 39</span> <span style="color: #ff0000;">    min-height</span>:<span style="color: #0000ff;"> 200px</span>;
<span style="color: #008080;"> 40</span> <span style="color: #ff0000;">    padding</span>:<span style="color: #0000ff;"> 0px 0px 10px 0</span>;
<span style="color: #008080;"> 41</span> <span style="color: #ff0000;">    *padding-top</span>:<span style="color: #0000ff;">10px</span>;
<span style="color: #008080;"> 42</span> <span style="color: #ff0000;">    -o-text-overflow</span>:<span style="color: #0000ff;"> ellipsis</span>;
<span style="color: #008080;"> 43</span> <span style="color: #ff0000;">    text-overflow</span>:<span style="color: #0000ff;"> ellipsis</span>;
<span style="color: #008080;"> 44</span> <span style="color: #ff0000;">    overflow</span>:<span style="color: #0000ff;"> hidden</span>;
<span style="color: #008080;"> 45</span> <span style="color: #ff0000;">    word-break</span>:<span style="color: #0000ff;"> break-all</span>;
<span style="color: #008080;"> 46</span>     
<span style="color: #008080;"> 47</span> <span style="color: #ff0000;">    float</span>:<span style="color: #0000ff;"> left</span>;
<span style="color: #008080;"> 48</span>     <span style="color: #008000;">/*</span><span style="color: #008000;"> margin-left: -20em; </span><span style="color: #008000;">*/</span><span style="color: #ff0000;">margin-right</span>:<span style="color: #0000ff;"> 20px</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;"> inline</span>;
<span style="color: #008080;"> 49</span> <span style="color: #ff0000;">    width</span>:<span style="color: #0000ff;"> 100%
</span><span style="color: #008080;"> 50</span> }
<span style="color: #008080;"> 51</span> <span style="color: #800000;">#sideBar </span>{
<span style="color: #008080;"> 52</span> <span style="color: #ff0000;">    width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 53</span> <span style="color: #ff0000;">    min-height</span>:<span style="color: #0000ff;"> 200px</span>;
<span style="color: #008080;"> 54</span> <span style="color: #ff0000;">    padding</span>:<span style="color: #0000ff;"> 0px 0 0px 5px</span>;
<span style="color: #008080;"> 55</span> <span style="color: #ff0000;">    float</span>:<span style="color: #0000ff;">right</span>;
<span style="color: #008080;"> 56</span> <span style="color: #ff0000;">    -o-text-overflow</span>:<span style="color: #0000ff;"> ellipsis</span>;
<span style="color: #008080;"> 57</span> <span style="color: #ff0000;">    text-overflow</span>:<span style="color: #0000ff;"> ellipsis</span>;
<span style="color: #008080;"> 58</span> <span style="color: #ff0000;">    overflow</span>:<span style="color: #0000ff;"> hidden</span>;
<span style="color: #008080;"> 59</span> <span style="color: #ff0000;">    word-break</span>:<span style="color: #0000ff;"> break-all</span>;
<span style="color: #008080;"> 60</span> <span style="color: #ff0000;">    display</span>:<span style="color: #0000ff;">none</span>;
<span style="color: #008080;"> 61</span> }
<span style="color: #008080;"> 62</span> <span style="color: #800000;">.newsItem .catListTitle </span>{
<span style="color: #008080;"> 63</span> <span style="color: #ff0000;">    display</span>:<span style="color: #0000ff;"> none</span>;
<span style="color: #008080;"> 64</span> <span style="color: #ff0000;">    width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 65</span> }
<span style="color: #008080;"> 66</span> <span style="color: #800000;">.newsItem,#blog-calendar </span>{
<span style="color: #008080;"> 67</span> <span style="color: #ff0000;">    margin-bottom</span>:<span style="color: #0000ff;">15px</span>;<span style="color: #ff0000;">text-indent</span>:<span style="color: #0000ff;">0</span>;<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;">10px</span>;<span style="color: #ff0000;">background</span>:<span style="color: #0000ff;"> #FAFCFD</span>;<span style="color: #ff0000;">border-radius</span>:<span style="color: #0000ff;">7px</span>;<span style="color: #ff0000;">box-shadow</span>:<span style="color: #0000ff;">1px 1px 2px #A7A8AD</span>;<span style="color: #ff0000;">line-height</span>:<span style="color: #0000ff;"> 1.5</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 68</span> }
<span style="color: #008080;"> 69</span> <span style="color: #008000;">/*</span><span style="color: #008000;">*日历控件样式开始*</span><span style="color: #008000;">*/</span>
<span style="color: #008080;"> 70</span> <span style="color: #800000;">#calendar </span>{
<span style="color: #008080;"> 71</span> <span style="color: #ff0000;">    margin-bottom</span>:<span style="color: #0000ff;"> 15px</span>;<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;">5px</span>;<span style="color: #ff0000;">border-radius</span>:<span style="color: #0000ff;">7px</span>;<span style="color: #ff0000;">box-shadow</span>:<span style="color: #0000ff;">1px 1px 2px #A7A8AD</span>;<span style="color: #ff0000;">background</span>:<span style="color: #0000ff;"> #fff</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 72</span> }
<span style="color: #008080;"> 73</span> <span style="color: #800000;">#calendar .Cal </span>{
<span style="color: #008080;"> 74</span> <span style="color: #ff0000;">    width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 75</span> <span style="color: #ff0000;">    line-height</span>:<span style="color: #0000ff;"> 1.5</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;
<span style="color: #008080;"> 76</span> }
<span style="color: #008080;"> 77</span> <span style="color: #800000;">#calendar th</span>{<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;">2px 5px</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;"> 78</span> <span style="color: #800000;">#calendar td</span>{<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;">2px 5px</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;"> 79</span> <span style="color: #800000;">#calendar td a</span>{<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;"> block</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;"> 80</span> <span style="color: #800000;">.Cal </span>{<span style="color: #008000;">/*</span><span style="color: #008000;">*日历容器table*</span><span style="color: #008000;">*/</span>
<span style="color: #008080;"> 81</span> <span style="color: #ff0000;">    border</span>:<span style="color: #0000ff;"> none</span>;
<span style="color: #008080;"> 82</span> <span style="color: #ff0000;">    color</span>:<span style="color: #0000ff;"> #666</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 83</span> }
<span style="color: #008080;"> 84</span> <span style="color: #800000;">#calendar table a:link, #calendar table a:visited, #calendar table a:active </span>{
<span style="color: #008080;"> 85</span> <span style="color: #ff0000;">    font-weight</span>:<span style="color: #0000ff;"> bold</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 86</span> }
<span style="color: #008080;"> 87</span> <span style="color: #800000;">#calendar table a:hover </span>{
<span style="color: #008080;"> 88</span> <span style="color: #ff0000;">    color</span>:<span style="color: #0000ff;"> white</span>;
<span style="color: #008080;"> 89</span> <span style="color: #ff0000;">    text-decoration</span>:<span style="color: #0000ff;"> none</span>;
<span style="color: #008080;"> 90</span> <span style="color: #ff0000;">    background-color</span>:<span style="color: #0000ff;"> #F60</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 91</span> }
<span style="color: #008080;"> 92</span> <span style="color: #800000;">.CalTodayDay</span>{<span style="color: #008000;">/*</span><span style="color: #008000;">*今天日期样式*</span><span style="color: #008000;">*/</span>
<span style="color: #008080;"> 93</span> <span style="color: #ff0000;">    color</span>:<span style="color: #0000ff;">#f60</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 94</span> }
<span style="color: #008080;"> 95</span> <span style="color: #800000;">#calendar .CalNextPrev a:link,#calendar  .CalNextPrev a:visited, #calendar .CalNextPrev a:active </span>{<span style="color: #008000;">/*</span><span style="color: #008000;">*上个月、下个月箭头样式*</span><span style="color: #008000;">*/</span>
<span style="color: #008080;"> 96</span> <span style="color: #ff0000;">    font-weight</span>:<span style="color: #0000ff;"> bold</span>;
<span style="color: #008080;"> 97</span> <span style="color: #ff0000;">    background-color</span>:<span style="color: #0000ff;"> white</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;"> 98</span> }
<span style="color: #008080;"> 99</span> <span style="color: #800000;">.CalDayHeader</span>{
<span style="color: #008080;">100</span> <span style="color: #ff0000;">    border-bottom</span>:<span style="color: #0000ff;">1px solid #ccc</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;    
<span style="color: #008080;">101</span> }
<span style="color: #008080;">102</span> <span style="color: #800000;">.CalTitle</span>{<span style="color: #008000;">/*</span><span style="color: #008000;">*日历年月头部样式*</span><span style="color: #008000;">*/</span>
<span style="color: #008080;">103</span> <span style="color: #ff0000;">    width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;">104</span> <span style="color: #ff0000;">    background</span>:<span style="color: #0000ff;">white</span>;
<span style="color: #008080;">105</span> <span style="color: #ff0000;">    color</span>:<span style="color: #0000ff;">black</span>;
<span style="color: #008080;">106</span> <span style="color: #ff0000;">    border-bottom</span>:<span style="color: #0000ff;">1px solid #666</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;    
<span style="color: #008080;">107</span> }
<span style="color: #008080;">108</span> <span style="color: #008000;">/*</span><span style="color: #008000;">*日历控件样式结束*</span><span style="color: #008000;">*/</span>
<span style="color: #008080;">109</span> <span style="color: #800000;">.catListTitle </span>{
<span style="color: #008080;">110</span> <span style="color: #ff0000;">background</span>:<span style="color: #0000ff;"> #390</span>;<span style="color: #ff0000;">border-bottom</span>:<span style="color: #0000ff;"> 1px solid #006600</span>;<span style="color: #ff0000;">border-top-left-radius</span>:<span style="color: #0000ff;"> 7px</span>;<span style="color: #ff0000;"> border-top-right-radius</span>:<span style="color: #0000ff;"> 7px</span>;<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> #FFFFFF</span>;<span style="color: #ff0000;">font-size</span>:<span style="color: #0000ff;"> 1.2em</span>;
<span style="color: #008080;">111</span> <span style="color: #ff0000;">height</span>:<span style="color: #0000ff;">1.8em</span>;
<span style="color: #008080;">112</span> <span style="color: #ff0000;">line-height</span>:<span style="color: #0000ff;">1.8em</span>;
<span style="color: #008080;">113</span> <span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;"> 5px</span>;
<span style="color: #008080;">114</span> <span style="color: #ff0000;">text-indent</span>:<span style="color: #0000ff;">0.5em</span>;<span style="color: #ff0000;">text-shadow</span>:<span style="color: #0000ff;"> 1px 1px 0 rgba(0, 0, 0, 0.3)</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;">115</span> }
<span style="color: #008080;">116</span> <span style="color: #800000;">.catListComment </span>{
<span style="color: #008080;">117</span> <span style="color: #ff0000;">    line-height</span>:<span style="color: #0000ff;"> 1.5</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;">118</span> }
<span style="color: #008080;">119</span> <span style="color: #800000;">.divRecentComment </span>{
<span style="color: #008080;">120</span> <span style="color: #ff0000;">    text-indent</span>:<span style="color: #0000ff;"> 2em</span>;
<span style="color: #008080;">121</span> <span style="color: #ff0000;">    color</span>:<span style="color: #0000ff;"> #666</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;">122</span> }
<span style="color: #008080;">123</span> <span style="color: #800000;">#sideBarMain ul </span>{
<span style="color: #008080;">124</span> <span style="color: #ff0000;">    line-height</span>:<span style="color: #0000ff;"> 1.5</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;">125</span> }
<span style="color: #008080;">126</span> <span style="color: #008000;">/*</span><span style="color: #008000;"> 最新评论等 开始 </span><span style="color: #008000;">*/</span>
<span style="color: #008080;">127</span> <span style="color: #800000;">#AjaxHolder_UpdatePanel1,
</span><span style="color: #008080;">128</span> <span style="color: #800000;">#AjaxHolder_PostComment_divCommnentArea,
</span><span style="color: #008080;">129</span> <span style="color: #800000;">#profile,
</span><span style="color: #008080;">130</span> <span style="color: #800000;">.entrylist,
</span><span style="color: #008080;">131</span> <span style="color: #800000;">.gallery
</span><span style="color: #008080;">132</span> {
<span style="color: #008080;">133</span> <span style="color: #ff0000;">background</span>:<span style="color: #0000ff;"> none repeat scroll 0 0 #FFFFFF</span>;
<span style="color: #008080;">134</span> <span style="color: #ff0000;">border-radius</span>:<span style="color: #0000ff;"> 7px</span>;
<span style="color: #008080;">135</span> <span style="color: #ff0000;">box-shadow</span>:<span style="color: #0000ff;">1px 1px 2px #A7A8AD</span>;
<span style="color: #008080;">136</span> <span style="color: #ff0000;">margin</span>:<span style="color: #0000ff;"> 0 0 15px 0</span>;
<span style="color: #008080;">137</span> <span style="color: #ff0000;">min-height</span>:<span style="color: #0000ff;"> 200px</span>;
<span style="color: #008080;">138</span> <span style="color: #ff0000;">overflow</span>:<span style="color: #0000ff;"> hidden</span>;
<span style="color: #008080;">139</span> <span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;">0 15px</span>;
<span style="color: #008080;">140</span> <span style="color: #ff0000;">text-overflow</span>:<span style="color: #0000ff;"> ellipsis</span>;
<span style="color: #008080;">141</span> <span style="color: #ff0000;">word-break</span>:<span style="color: #0000ff;"> break-all</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;
<span style="color: #008080;">142</span> }
<span style="color: #008080;">143</span> <span style="color: #800000;">#AjaxHolder_PostComment_divCommnentArea</span>{<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;"> 10px</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">144</span> <span style="color: #800000;">#profile,
</span><span style="color: #008080;">145</span> <span style="color: #800000;">.entrylist,
</span><span style="color: #008080;">146</span> <span style="color: #800000;">.gallery
</span><span style="color: #008080;">147</span> {<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;"> 10px</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">148</span> <span style="color: #800000;">.catListEssay,.catListLink,.catListNoteBook,
</span><span style="color: #008080;">149</span> <span style="color: #800000;">.catListTag,
</span><span style="color: #008080;">150</span> <span style="color: #800000;">.catListPostCategory,
</span><span style="color: #008080;">151</span> <span style="color: #800000;">.catListPostArchive,
</span><span style="color: #008080;">152</span> <span style="color: #800000;">.catListImageCategory,
</span><span style="color: #008080;">153</span> <span style="color: #800000;">.catListArticleArchive,
</span><span style="color: #008080;">154</span> <span style="color: #800000;">.catListView,
</span><span style="color: #008080;">155</span> <span style="color: #800000;">.catListFeedback,
</span><span style="color: #008080;">156</span> <span style="color: #800000;">.mySearch,
</span><span style="color: #008080;">157</span> <span style="color: #800000;">.catListComment,
</span><span style="color: #008080;">158</span> <span style="color: #800000;">.catListBlogRank,
</span><span style="color: #008080;">159</span> <span style="color: #800000;">.catList,
</span><span style="color: #008080;">160</span> <span style="color: #800000;">.catListArticleCategory
</span><span style="color: #008080;">161</span> {<span style="color: #ff0000;">margin-bottom</span>:<span style="color: #0000ff;"> 15px</span>;<span style="color: #ff0000;">background</span>:<span style="color: #0000ff;"> #FAFCFD</span>;<span style="color: #ff0000;">border-radius</span>:<span style="color: #0000ff;">7px</span>;<span style="color: #ff0000;">box-shadow</span>:<span style="color: #0000ff;">1px 1px 2px #A7A8AD</span>;<span style="color: #ff0000;">overflow</span>:<span style="color: #0000ff;"> hidden</span>;<span style="color: #ff0000;">zoom</span>:<span style="color: #0000ff;"> 1</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">162</span> <span style="color: #800000;">.catListEssay ul li,.catListLink ul li,.catListNoteBook ul li,
</span><span style="color: #008080;">163</span> <span style="color: #800000;">.catListTag ul li,
</span><span style="color: #008080;">164</span> <span style="color: #800000;">.catListPostCategory ul li,
</span><span style="color: #008080;">165</span> <span style="color: #800000;">.catListPostArchive ul li,
</span><span style="color: #008080;">166</span> <span style="color: #800000;">.catListImageCategory ul li,
</span><span style="color: #008080;">167</span> <span style="color: #800000;">.catListArticleArchive ul li,
</span><span style="color: #008080;">168</span> <span style="color: #800000;">.catListView ul li,
</span><span style="color: #008080;">169</span> <span style="color: #800000;">.catListFeedback ul li,
</span><span style="color: #008080;">170</span> <span style="color: #800000;">.catListComment ul li,
</span><span style="color: #008080;">171</span> <span style="color: #800000;">.catListBlogRank ul li,
</span><span style="color: #008080;">172</span> <span style="color: #800000;">.catList ul li,
</span><span style="color: #008080;">173</span> <span style="color: #800000;">.catListArticleCategory ul li
</span><span style="color: #008080;">174</span> {<span style="color: #ff0000;">text-indent</span>:<span style="color: #0000ff;">1em</span>;<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;"> 10px 5px</span>;<span style="color: #ff0000;">border-bottom</span>:<span style="color: #0000ff;"> 1px solid #DADFE1</span>;<span style="color: #ff0000;"> border-top</span>:<span style="color: #0000ff;"> 1px solid #FFFFFF</span>;<span style="color: #ff0000;"> overflow</span>:<span style="color: #0000ff;"> hidden</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">175</span> <span style="color: #800000;">.catListEssay ul li a,.catListLink ul li a,.catListNoteBook ul li a,
</span><span style="color: #008080;">176</span> <span style="color: #800000;">.catListTag ul li a,
</span><span style="color: #008080;">177</span> <span style="color: #800000;">.catListPostCategory ul li a,
</span><span style="color: #008080;">178</span> <span style="color: #800000;">.catListPostArchive ul li a,
</span><span style="color: #008080;">179</span> <span style="color: #800000;">.catListImageCategory ul li a,
</span><span style="color: #008080;">180</span> <span style="color: #800000;">.catListArticleArchive ul li a,
</span><span style="color: #008080;">181</span> <span style="color: #800000;">.catListView ul li a,
</span><span style="color: #008080;">182</span> <span style="color: #800000;">.catListFeedback ul li a,
</span><span style="color: #008080;">183</span> <span style="color: #800000;">.catListComment ul li a,
</span><span style="color: #008080;">184</span> <span style="color: #800000;">.catListBlogRank ul li a,
</span><span style="color: #008080;">185</span> <span style="color: #800000;">.catList ul li a
</span><span style="color: #008080;">186</span> <span style="color: #800000;">.catListArticleCategory ul li a
</span><span style="color: #008080;">187</span> {<span style="color: #ff0000;">text-indent</span>:<span style="color: #0000ff;"> 1em</span>;<span style="color: #ff0000;">font-size</span>:<span style="color: #0000ff;"> 12px</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">188</span> <span style="color: #800000;">.catListEssay ul li a:hover,.catListLink ul li a:hover,.catListNoteBook ul li a:hover,
</span><span style="color: #008080;">189</span> <span style="color: #800000;">.catListTag ul li a:hover,
</span><span style="color: #008080;">190</span> <span style="color: #800000;">.catListPostCategory ul li a:hover,
</span><span style="color: #008080;">191</span> <span style="color: #800000;">.catListPostArchive ul li a:hover,
</span><span style="color: #008080;">192</span> <span style="color: #800000;">.catListImageCategory ul li a:hover,
</span><span style="color: #008080;">193</span> <span style="color: #800000;">.catListView ul li a:hover,
</span><span style="color: #008080;">194</span> <span style="color: #800000;">.catListFeedback ul li a:hover,
</span><span style="color: #008080;">195</span> <span style="color: #800000;">.catListArticleArchive ul li a:hover,
</span><span style="color: #008080;">196</span> <span style="color: #800000;">.catListComment ul li a:hover
</span><span style="color: #008080;">197</span> {<span style="color: #ff0000;">text-decoration</span>:<span style="color: #0000ff;"> none</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">198</span> <span style="color: #800000;">.divRecentCommentAticle</span>{<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;">0 10px</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">199</span> <span style="color: #800000;">.divRecentComment</span>{<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;"> 10px</span>;<span style="color: #ff0000;">font-size</span>:<span style="color: #0000ff;"> 12px</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">200</span> <span style="color: #800000;">#AjaxHolder_PostComment_divCommnentArea td</span>{<span style="color: #ff0000;">padding</span>:<span style="color: #0000ff;"> 5px 0</span>;<span style="color: #ff0000;">display</span>:<span style="color: #0000ff;">none</span>;<span style="color: #ff0000;">width</span>:<span style="color: #0000ff;">0px</span>;}
<span style="color: #008080;">201</span> <span style="color: #008000;">/*</span><span style="color: #008000;"> 最新评论等 结束 </span><span style="color: #008000;">*/</span>
<span style="color: #008080;">202</span> <span style="color: #800000;">.postBody </span>{
<span style="color: #008080;">203</span> <span style="color: #ff0000;">    padding</span>:<span style="color: #0000ff;"> 15px 2px 5px 5px</span>;
<span style="color: #008080;">204</span> <span style="color: #ff0000;">    line-height</span>:<span style="color: #0000ff;"> 1.5</span>;
<span style="color: #008080;">205</span> <span style="color: #ff0000;">    color</span>:<span style="color: #0000ff;"> #000</span>;
<span style="color: #008080;">206</span> <span style="color: #ff0000;">    border-bottom</span>:<span style="color: #0000ff;"> 1px solid #ccc</span>;
<span style="color: #008080;">207</span> }
<span style="color: #008080;">208</span> <span style="color: #800000;">.postBody img</span>{<span style="color: #ff0000;"> width</span>:<span style="color: #0000ff;">320px</span>;<span style="color: #ff0000;"> height</span>:<span style="color: #0000ff;">auto</span>;<span style="color: #ff0000;"> float</span>:<span style="color: #0000ff;">left</span>;}
<span style="color: #008080;">209</span> <span style="color: #008000;">/*</span><span style="color: #008000;">****侧边栏结束*******************************</span><span style="color: #008000;">*/</span>
<span style="color: #008080;">210</span> <span style="color: #800000;">}</span>
Copy after login
View Code

需要注意的是:

1.css代码中需要将侧边栏进行隐藏

2.内容页需要统一的设置一下图片的显示大小否则不能全部显示

3.注意页面的整体大小

效果图:

 

 

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

How do I use HTML5 form validation attributes to validate user input? How do I use HTML5 form validation attributes to validate user input? Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

What are the best practices for cross-browser compatibility in HTML5? What are the best practices for cross-browser compatibility in HTML5? Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is the viewport meta tag? Why is it important for responsive design? What is the viewport meta tag? Why is it important for responsive design? Mar 20, 2025 pm 05:56 PM

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

How do I use the HTML5 <time> element to represent dates and times semantically? How do I use the HTML5 <time> element to represent dates and times semantically? Mar 12, 2025 pm 04:05 PM

This article explains the HTML5 &lt;time&gt; element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

See all articles