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

本文参考吕大豹的博客

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

第一步:

在页首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>

第二步:

修改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> }        

由于模板的不同所以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>
View Code

需要注意的是:

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

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

3.注意页面的整体大小

效果图:

 

 

 

Statement
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
HTML as a Markup Language: Its Function and PurposeHTML as a Markup Language: Its Function and PurposeApr 22, 2025 am 12:02 AM

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

See all articles

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools