styles

How to remove all inherited and computed styles from an element?

这一生的挚爱 提交于 2019-12-19 07:11:41
问题 The page has the following CSS: input[type=text] { display: inline; padding: 7px; background-color: #f6f6f6; font-size: 12px; letter-spacing: 1px; border: 1px solid #aac7d1; /* lots of other styles here... */ } I have many text-input elements and the following: <input type="text" id="txt1" /> And I try to apply different styles to this individual textbox (txt1) via jQuery: $('#txt1').removeClass().removeAttr('style').css({ 'background-color': '#ff0000', //lots of other styles here... }); But

.Net enumerate winforms font styles?

霸气de小男生 提交于 2019-12-19 06:30:20
问题 I have been searching around for a way to list the valid font styles for a given font using the .Net framework (even if I have to pinvoke gdi32 or some other API) since not all fonts fall into the System.Drawing.FontStyle enum values (Bold, Italic, Regular, Strikeout, Underline). A perfect example of a font that does not fit the bill is Segoe UI, which is a TrueType Microsoft font, with font styles of: Regular, Semibold, Light, Bold, Italic, and BoldItalic. Another example is Arial which has:

WPF - RelativeSource in Style

大憨熊 提交于 2019-12-19 05:52:50
问题 My target is to bind the Content -Property of the Label to the Tag -Property of the Elements the Style is applied to . But my solution doesn't seem to work: My style: <Style TargetType="TextBox" x:Key="HintedTextBox"> <Style.Resources> <VisualBrush AlignmentX="Left" AlignmentY="Center" Stretch="None" x:Key="HintedTextBox_Hint"> <VisualBrush.Visual> <Label Content="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" Foreground="LightGray" /> </VisualBrush.Visual> </VisualBrush> </Style

Changing android actionbar button style

早过忘川 提交于 2019-12-19 04:56:18
问题 I'm currently changing the view on my ActionBar MenuItem like so: MenuItem menuItem = menu.add(title); TextView tv = new TextView(context); tv.setTypeface(myTypeface); tv.setText("hello"); menuItem.setActionView(tv); However this disabled the function of the button, which I'm assuming is because I've changed the ActionView . Is there anyway I can do this whilst retaining the button function? 回答1: Here's an example of creating a custom MenuItem for the ActionBar . First : Create the View that

I need to see an HTML image map area

…衆ロ難τιáo~ 提交于 2019-12-19 04:02:37
问题 I am trying to set a map area on my image, but I want it to be an octagon so I really need to see what I'm drawing. Unfortunately there is not way for me to style the area tag so that I can see where the mapping is taking place. This is making it really difficult for me to draw these areas, I have to follow it with the mouse every time to know where it begins and where it ends. Is there a better way ? I'm posting this example with a rectangle just to keep things simple, I just want to see it,

Android: change color of disabled text using Theme/Style?

与世无争的帅哥 提交于 2019-12-18 18:54:50
问题 I have the following colors defined in my color.xml: <color name="gold">#d49e43</color> <color name="gold_disabled">#80d49e43</color> And the following theme: <style name="Theme.Example" parent="@style/Theme.Sherlock"> <item name="android:textColor">@color/gold</item> </style> In my SettingsActivity, I have a CheckBoxPreference and a Preference that depends on it. When The CheckBoxPreference is unchecked, the Preference is disabled, however, because of the custom gold text color that I set,

Add a State property to an Inline Style in React

邮差的信 提交于 2019-12-18 17:04:45
问题 I have a react element that has an inline style like this: (Shortened version) <div className='progress-bar' role='progressbar' style={{width: '30%'}}> </div> I want to replace the width with a property from my state, although I'm not quite sure how to do it. I tried: <div className='progress-bar' role='progressbar' style={{{width: this.state.percentage}}}> </div> Is this even possible? 回答1: You can do it like this style={ { width: `${ this.state.percentage }%` } } Example 回答2: yes its

How can I get a trigger to change the color of a TextBlock based on a DataContext Property?

雨燕双飞 提交于 2019-12-18 16:55:24
问题 Why does the following code get the runtime error: Members of the Triggers collection must be of type EventTrigger But the EventTrigger element doesn't have a Binding property. So how do I change the color of the TextBlock based on the DataContext Property? XAML: <Window x:Class="TestTrigger123345.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel

Styling html text without CSS

自闭症网瘾萝莉.ら 提交于 2019-12-18 16:53:10
问题 I would like to html code part of my tumblr page, but in the context, I can't add any css. Is there any way to format text size, font, color, etc. without using css? I looked at <font> tags but they don't seem to be supported in html5. Is there a workaround or tag that would do this for me? Thanks for all your help 回答1: Add CSS as a style directly to the tag you want to format. EX. <p style="width:20px;height:20px;background-color:#ffcc00;">The contents go here</p> 回答2: With HTML alone,

How to reference from drawable to style

限于喜欢 提交于 2019-12-18 15:54:23
问题 My app with tabs has two themes. In each theme tabs have different images in selected and unselected state. How I can properly reference to image by theme? For example. I have in themes.xml <?xml version="1.0" encoding="utf-8"?> <style name="LightTheme" parent="@android:style/Theme.Light"> <item name="tabShows">@drawable/ic_tab_shows_unselected_light</item> <item name="tabShowsSelected">@drawable/ic_tab_shows_selected_light</item> <item name="tabNews">@drawable/ic_tab_news_selected_light<