Silverlight 样式的灵活使用

众所周知,Silverlight将界面设计与代码实现分开。即便如此,如果不能灵活地运用样式Style,开发的效率依然会比较低。比如,针对类似的TextBlock,你可能需要反复地在设计器xaml中复制粘贴很多行设计器代码。但如果开发人员掌握了样式的使用,可以一次设计,到处使用。

(一)获取一个控件的样式Style文件

这里以FloatableWindow控件为例

(1)打开一个继承自FloatableWindow的控件OverlapControl的设计器文件OverlapControl.xaml,在菜单栏中点击”视图->在Blend中打开“(View->Open in Blend),如下如所示

(2)打开Blend之后,在Object and Timeline视图中,右键"FloatableWindow",并选择“Edit Template->Create Empty”,创建新一个新的资源字典ResourceDictionary.xaml:

(3)假如该控件没有与任何ResourceDictionary文件关联,则需要新建一个资源字典文件ResourceDictionary:

(4)修改资源字典文件的名称,点击“确定”(OK),如此,就可以在当前目录看到创建的资源字典文件FloatableWindowStyle.xaml

此时,在OverlapControl.xaml设计器文件中,会多上几行引用的代码:

(二)调整或设置控件的样式Style文件

此时,重新再Blend中打开OverlapControl.xaml或者打开FloatableWindowStyle.xaml,可以对FloatableWindow的样式进行调整,或者设置其对应的参数:

(1)打开编辑样式资源的开关:

(2)随后,在视图区中,可以看到FloatableWindow的简单视图:

(3)选中“属性”(Properties)选项卡,可以非常方便地设置该控件的参数:

(4)当然,开发人员也可以在设计器文件中直接调整参数的值,一下代码本人调整好后的代码:

  1 <ResourceDictionary
  2     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:windows="clr-namespace:System.Windows.Controls;assembly=FloatableWindow">
  4     <!-- Resource dictionary entries should be defined here. -->
  5     <LinearGradientBrush x:Key="HeaderBackgroundBrush"  EndPoint="0,0" StartPoint="0,1">
  6         <GradientStop Offset="0.0" Color="#92bfbe"/>
  7         <GradientStop Offset="0.2" Color="#8dc5c4"/>
  8         <GradientStop Offset="0.8" Color="#8dc5c4"/>
  9         <GradientStop Offset="1.0" Color="#92bfbe"/>
 10     </LinearGradientBrush>
 11
 12     <SolidColorBrush x:Key="HeaderBorderBrush" Color="#ff9bb6b5" />
 13
 14     <Style x:Key="FloatableWindowStyle1" TargetType="windows:FloatableWindow">
 15
 16
 17         <Setter Property="IsTabStop" Value="false"/>
 18         <Setter Property="TabNavigation" Value="Cycle"/>
 19         <Setter Property="HorizontalAlignment" Value="Center"/>
 20         <Setter Property="VerticalAlignment" Value="Center"/>
 21         <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
 22         <Setter Property="VerticalContentAlignment" Value="Stretch"/>
 23         <Setter Property="BorderThickness" Value="1"/>
 24         <Setter Property="BorderBrush">
 25             <Setter.Value>
 26                 <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
 27                     <GradientStop Color="#FFA3AEB9" Offset="0"/>
 28                     <GradientStop Color="#FF8399A9" Offset="0.375"/>
 29                     <GradientStop Color="#FF718597" Offset="0.375"/>
 30                     <GradientStop Color="#FF617584" Offset="1"/>
 31                 </LinearGradientBrush>
 32             </Setter.Value>
 33         </Setter>
 34         <Setter Property="OverlayBrush" Value="#7F000000"/>
 35         <Setter Property="OverlayOpacity" Value="1"/>
 36         <Setter Property="Template">
 37             <Setter.Value>
 38                 <ControlTemplate TargetType="windows:FloatableWindow">
 39                     <Grid x:Name="Root">
 40                         <Grid.Resources>
 41                             <Style x:Key="ButtonStyle" TargetType="Button">
 42                                 <Setter Property="Background" Value="#FF1F3B53"/>
 43                                 <Setter Property="Foreground" Value="#FF000000"/>
 44                                 <Setter Property="Padding" Value="3"/>
 45                                 <Setter Property="BorderThickness" Value="1"/>
 46                                 <Setter Property="BorderBrush">
 47                                     <Setter.Value>
 48                                         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
 49                                             <GradientStop Color="#FFA3AEB9" Offset="0"/>
 50                                             <GradientStop Color="#FF8399A9" Offset="0.375"/>
 51                                             <GradientStop Color="#FF718597" Offset="0.375"/>
 52                                             <GradientStop Color="#FF617584" Offset="1"/>
 53                                         </LinearGradientBrush>
 54                                     </Setter.Value>
 55                                 </Setter>
 56                                 <Setter Property="Template">
 57                                     <Setter.Value>
 58                                         <ControlTemplate TargetType="Button">
 59                                             <Grid x:Name="grid" Background="#02FFFFFF" HorizontalAlignment="Center" Height="14" VerticalAlignment="Center" Width="15">
 60                                                 <VisualStateManager.VisualStateGroups>
 61                                                     <VisualStateGroup x:Name="CommonStates">
 62                                                         <VisualState x:Name="Normal"/>
 63                                                         <VisualState x:Name="MouseOver">
 64                                                             <Storyboard>
 65                                                                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz2">
 66                                                                     <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
 67                                                                 </ObjectAnimationUsingKeyFrames>
 68                                                                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz1">
 69                                                                     <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
 70                                                                 </ObjectAnimationUsingKeyFrames>
 71                                                                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz0">
 72                                                                     <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
 73                                                                 </ObjectAnimationUsingKeyFrames>
 74                                                                 <DoubleAnimation Duration="0" To="0.95" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="X"/>
 75                                                             </Storyboard>
 76                                                         </VisualState>
 77                                                         <VisualState x:Name="Pressed">
 78                                                             <Storyboard>
 79                                                                 <DoubleAnimation Duration="0" To="0.85" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="X"/>
 80                                                                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz2">
 81                                                                     <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
 82                                                                 </ObjectAnimationUsingKeyFrames>
 83                                                                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz1">
 84                                                                     <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
 85                                                                 </ObjectAnimationUsingKeyFrames>
 86                                                                 <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="X_Fuzz0">
 87                                                                     <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
 88                                                                 </ObjectAnimationUsingKeyFrames>
 89                                                             </Storyboard>
 90                                                         </VisualState>
 91                                                         <VisualState x:Name="Disabled">
 92                                                             <Storyboard>
 93                                                                 <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="X"/>
 94                                                             </Storyboard>
 95                                                         </VisualState>
 96                                                     </VisualStateGroup>
 97                                                 </VisualStateManager.VisualStateGroups>
 98                                                 <Path x:Name="X_Fuzz2" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" Fill="#14C51900" HorizontalAlignment="Center" Height="8" Margin="0,-1,0,0" Opacity="1" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Stroke="#14C51900" Visibility="Collapsed" VerticalAlignment="Center" Width="9">
 99                                                     <Path.RenderTransform>
100                                                         <TransformGroup>
101                                                             <ScaleTransform ScaleY="1.3" ScaleX="1.3"/>
102                                                         </TransformGroup>
103                                                     </Path.RenderTransform>
104                                                 </Path>
105                                                 <Path x:Name="X_Fuzz1" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" Fill="#1EC51900" HorizontalAlignment="Center" Height="8" Margin="0,-1,0,0" Opacity="1" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Stroke="#1EC51900" Visibility="Collapsed" VerticalAlignment="Center" Width="9">
106                                                     <Path.RenderTransform>
107                                                         <TransformGroup>
108                                                             <ScaleTransform ScaleY="1.1" ScaleX="1.1"/>
109                                                         </TransformGroup>
110                                                     </Path.RenderTransform>
111                                                 </Path>
112                                                 <Path x:Name="X_Fuzz0" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" Fill="#FFC51900" HorizontalAlignment="Center" Height="8" Margin="0,-1,0,0" Opacity="1" Stretch="Fill" Stroke="#FFC51900" Visibility="Collapsed" VerticalAlignment="Center" Width="9"/>
113                                                 <Path x:Name="X" Data="F1 M 6.742676,3.852539 L 9.110840,1.559570 L 8.910645,0.500000 L 6.838379,0.500000 L 4.902832,2.435547 L 2.967285,0.500000 L 0.895020,0.500000 L 0.694824,1.559570 L 3.062988,3.852539 L 0.527832,6.351563 L 0.689941,7.600586 L 2.967285,7.600586 L 4.897949,5.575195 L 6.854004,7.600586 L 9.115723,7.600586 L 9.277832,6.351563 L 6.742676,3.852539 Z" Fill="#FFFFFFFF" HorizontalAlignment="Center" Height="8" Margin="0,-1,0,0" Opacity="0.7" Stretch="Fill" VerticalAlignment="Center" Width="9">
114                                                     <Path.Stroke>
115                                                         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
116                                                             <GradientStop Color="#FF313131" Offset="1"/>
117                                                             <GradientStop Color="#FF8E9092" Offset="0"/>
118                                                         </LinearGradientBrush>
119                                                     </Path.Stroke>
120                                                 </Path>
121                                             </Grid>
122                                         </ControlTemplate>
123                                     </Setter.Value>
124                                 </Setter>
125                             </Style>
126                         </Grid.Resources>
127                         <VisualStateManager.VisualStateGroups>
128                             <VisualStateGroup x:Name="WindowStates">
129                                 <VisualState x:Name="Open">
130                                     <Storyboard>
131                                         <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Overlay">
132                                             <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
133                                             <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="1"/>
134                                         </DoubleAnimationUsingKeyFrames>
135                                         <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX" Storyboard.TargetName="ContentRoot">
136                                             <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
137                                             <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
138                                             <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1"/>
139                                             <SplineDoubleKeyFrame KeySpline="0,0,0.5,1" KeyTime="00:00:00.45" Value="1.05"/>
140                                             <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1"/>
141                                         </DoubleAnimationUsingKeyFrames>
142                                         <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY" Storyboard.TargetName="ContentRoot">
143                                             <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
144                                             <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="0"/>
145                                             <SplineDoubleKeyFrame KeyTime="00:00:00.4" Value="1"/>
146                                             <SplineDoubleKeyFrame KeySpline="0,0,0.5,1" KeyTime="00:00:00.45" Value="1.05"/>
147                                             <SplineDoubleKeyFrame KeyTime="00:00:00.55" Value="1"/>
148                                         </DoubleAnimationUsingKeyFrames>
149                                     </Storyboard>
150                                 </VisualState>
151                                 <VisualState x:Name="Closed">
152                                     <Storyboard>
153                                         <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Overlay">
154                                             <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
155                                             <EasingDoubleKeyFrame KeyTime="00:00:00.3" Value="0"/>
156                                         </DoubleAnimationUsingKeyFrames>
157                                         <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleX" Storyboard.TargetName="ContentRoot">
158                                             <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1"/>
159                                             <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05"/>
160                                             <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0"/>
161                                         </DoubleAnimationUsingKeyFrames>
162                                         <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(RenderTransform).(Children)[0].ScaleY" Storyboard.TargetName="ContentRoot">
163                                             <SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1"/>
164                                             <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1.05"/>
165                                             <SplineDoubleKeyFrame KeyTime="00:00:00.45" Value="0"/>
166                                         </DoubleAnimationUsingKeyFrames>
167                                     </Storyboard>
168                                 </VisualState>
169                             </VisualStateGroup>
170                         </VisualStateManager.VisualStateGroups>
171                         <Grid x:Name="Overlay" Background="{TemplateBinding OverlayBrush}" HorizontalAlignment="Stretch" Margin="0" Opacity="{TemplateBinding OverlayOpacity}" VerticalAlignment="Top"/>
172                         <Grid x:Name="ContentRoot" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Height="{TemplateBinding Height}" RenderTransformOrigin="0.5,0.5"
173                               VerticalAlignment="{TemplateBinding VerticalAlignment}" Width="{TemplateBinding Width}">
174                             <Grid.RenderTransform>
175                                 <TransformGroup>
176                                     <ScaleTransform/>
177                                     <SkewTransform/>
178                                     <RotateTransform/>
179                                     <TranslateTransform/>
180                                 </TransformGroup>
181                             </Grid.RenderTransform>
182
183                             <Border BorderBrush="#14000000" BorderThickness="1" Background="#14000000" CornerRadius="2" HorizontalAlignment="Stretch" Margin="-1" VerticalAlignment="Stretch"/>
184                             <Border BorderBrush="#0F000000" BorderThickness="1" Background="#0F000000" CornerRadius="2.25" HorizontalAlignment="Stretch" Margin="-2" VerticalAlignment="Stretch"/>
185                             <Border BorderBrush="#0C000000" BorderThickness="1" Background="#0C000000" CornerRadius="2.5" HorizontalAlignment="Stretch" Margin="-3" VerticalAlignment="Stretch"/>
186                             <Border BorderBrush="#0A000000" BorderThickness="1" Background="#0A000000" CornerRadius="2.75" HorizontalAlignment="Stretch" Margin="-4" VerticalAlignment="Stretch"/>
187
188                             <!--*********************************整个面板的边框***********************************-->
189                             <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="#FFFFFFFF" CornerRadius="5">
190                                 <Border CornerRadius="1.5" Margin="0">
191                                     <Border.Background><!--面板背景色-->
192                                         <!--
193                                         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
194                                             <GradientStop Color="#FFE5E8EB" Offset="1"/>
195                                             <GradientStop Color="#FFF6F8F9" Offset="0"/>
196                                         </LinearGradientBrush>
197                                         -->
198                                         <LinearGradientBrush  StartPoint="0.5,0" EndPoint="0.5,1">
199                                             <GradientStop Offset="0" Color="#FFffffff"/>
200                                             <GradientStop Offset="1.0" Color="#FFffffff"/>
201                                         </LinearGradientBrush>
202                                     </Border.Background>
203                                     <Grid>
204                                         <Grid.RowDefinitions>
205                                             <RowDefinition Height="Auto"/>
206                                             <RowDefinition/>
207                                         </Grid.RowDefinitions>
208
209                                         <!--*********************************标题框……边框***********************************-->
210                                         <Border x:Name="Chrome" BorderBrush="{StaticResource HeaderBorderBrush}" BorderThickness="1,1,1,1" Width="Auto" Background="{StaticResource HeaderBackgroundBrush}">
211
212                                             <Grid Height="Auto" Width="Auto">
213                                                 <Grid.ColumnDefinitions>
214                                                     <ColumnDefinition/>
215                                                     <ColumnDefinition Width="30"/>
216                                                 </Grid.ColumnDefinitions>
217
218                                                 <!--******************************************************标题***************************************-->
219                                                 <ContentControl Content="{TemplateBinding Title}" FontWeight="Bold" HorizontalAlignment="Stretch" IsTabStop="False"
220                                                 Margin="6,3,6,3" VerticalAlignment="Center"/>
221
222                                                 <!--******************************************************关闭按钮***************************************-->
223                                                 <Button x:Name="CloseButton" Grid.Column="1" HorizontalAlignment="Center" Height="14" IsTabStop="False" Cursor="Hand"
224                                                 Style="{StaticResource ButtonStyle}" VerticalAlignment="Center" Width="15"/>
225                                             </Grid>
226                                         </Border>
227
228                                         <!--******************************************************主要内容区域***************************************-->
229                                         <Border Background="{TemplateBinding Background}" Margin="7" Grid.Row="1">
230                                             <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
231                                         </Border>
232                                         <!--******************************************************右下角 的透明三角形,控制伸缩***************************************-->
233                                         <Path x:Name="Resizer" Data="M15.499995,0.5 L15.499995,15.5 L0.5,15.5 z" Fill="#FFB1B1B1"
234                                         HorizontalAlignment="Right" Height="20" Opacity=".25" Grid.Row="1" Stretch="Fill" UseLayoutRounding="False"
235                                         VerticalAlignment="Bottom" Width="20"/>
236                                     </Grid>
237                                 </Border>
238                             </Border>
239                         </Grid>
240                     </Grid>
241                 </ControlTemplate>
242             </Setter.Value>
243         </Setter>
244     </Style>
245 </ResourceDictionary>

FloatableWindowStyle.xaml

(5)简单地介绍一下如何设置一个控件的样式Style

(三)引用控件的样式Style文件

时间: 2024-10-03 01:47:47

Silverlight 样式的灵活使用的相关文章

Silverlight样式定义

方法一.定义在控件内部 1 <Canvas Background="Red" Height="100" HorizontalAlignment="Left" Margin="90,80,0,0" Name="canvas1" VerticalAlignment="Top" Width="200" /> 方法二.定义在控件外部 1 <UserContr

yii2的form表单样式怎么灵活控制呢?

<?php $form = ActiveForm::begin(['id' => 'login-form', 'fieldConfig'=>[ 'template'=> "{label}<div >{input}</div>\n{error}",]]); ?> $form = ActiveForm::begin([ 'fieldConfig'=>[ 'template'=> "{label}\n<div

4.2 样式表的基本语法

样式表由样式规则组成,这些规则告诉浏览器如何显示文档.一个样式(STYLE)的基本语法由3部分构成:selector(中文叫选择器,有点怪怪的,就用英文吧!),属性(property)和属性值(value). 本节单词记忆:标签 1.style 属性 1.class 2.font-size 3.font-family 网页学习网提示:html语言非常简单,不需要逻辑理解,而绝大部分朋友觉得它难以掌握,90%的原因在于英语单词不过关,所以每节记忆几个单词是非常有必要的. 一.样式表的基本结构 <S

通用 css 样式库 rich.css

日期: 25 Dec 2018 ?? rich.css 用创新的方式,实现了动态的,可定制的,全覆盖的 css 样式库.无需开发 css 样式,也无需在 css html js 间切换,实现了样表库的名称编程. 传统的方式与问题 web base app 样式开发主要依赖 css 实现,css 的技术和高度定制要求开发者,必须有效组织大量的 css 文件和设计 css 对象.在页面众多的大型项目上,不得不编写大量 css 类,或者根据元素 id 定制 css 样式,甚至用内联在 html 上的样

Prism 4 文档 ---第8章 导航

作为同用户具有丰富的交互的客户端应用程序,它的用户界面(UI)将会持续不断的更新来反映用户工作的当前的任务和数据.用户界面可以进行一段时间相当大的变化作为用户交互的应用程序中完成各种任务.通过该应用程序协调这些用户界面的变化的过程通常被称为导航. 经常,导航意味着某些控件将会从UI中移除,其他的控件将会被添加到UI中.在另外的情况下,导航也意味着一个或多个存在的控件的可视化状态被更新.---例如,一些控件可能被简单的隐藏或收缩而另外的一些控件被显示后展开.类似的,导航可能意味着一个控件展示的绑定

转 css选择器

CSS是对网页设计师可用的最强大的工具之一.使用它我们可以在几分钟内改变一个网站的界面,而不用改变页面的标签.但是尽管事实上,我们每个人也都意识到了它是有用的,CSS 选择器远未发挥它们的潜力,有的时候我们还趋向于使用过多的和无用的class.id.div.span等把我们的HTML搞的很凌乱. 避免让这些“瘟疫”在你的标签中传播并保持其简洁和语义化的最佳方式,就是使用更复杂的CSS选择器,它们可以定位于指定的元素而不用使用额外的class或id,而且通过这种方式也可以让我们的代码和样式更加灵活

[css 揭秘]:CSS揭秘 技巧(二):多重边框

我的github地址:https://github.com/FannieGirl/ifannie/ 源码都在这上面哦! 喜欢的给我一个星吧 多重边框 问题:我们通常希望在css代码层面以更灵活的方式来调整边框样式 方案一:box-shadow 目前为止,我们大多数人可能已经用过(或者滥用过)box-shadow来生成投影,不太为人之的是,它还接受四个参数(扩张半径),通过制定正值或负值,可以让投影面积加大或者减小, 用它的好处是它支持逗号分隔语法,我们可以创建任意数量的投影 知识背景:box-s

关于在WP8.1中使用剪贴板的问题

熟悉WindowsPhone8.0和WindowsPhone8.1开发的朋友都应该很清楚,在windowphone8.0的 开发时代下,我们可以很轻松的使用系统提供的API进行简单的文本拷贝和复制.但是,到了WindowsPhone8.1时代,情况却大不相同,微软竟然把这个API接口给阉割了,这令很多开发者所发指,说实话,我也是很无语的,还好在即将到来的Windows10中,微软又为开发者加上了这个API接口方便开发者进行使用.在本文中,笔者主要讲述在WindowsPhone8.1下该如何解决无

2天驾驭DIV+CSS (基础篇)(转)

这是去年看到的一片文章,感觉在我的学习中,有不少的影响.于是把它分享给想很快了解css的兄弟们. 基础篇[知识一] “DIV+CSS” 的叫法是不准确的[知识二] “DIV+CSS” 将你引入两大误区[知识三] 什么是W3C标准?[基础一] CSS如何控制页面[基础二] CSS选择器[基础三] CSS选择器命名及常用命名[基础四] 盒子模型[基础五] 块状元素和内联元素 实战篇[第一课] 实战小热身[第二课] 浮动[第三课] 清除浮动[第四课] 导航条(上) | 导航条(下)[大练习] 前四节课