Font size in CSS – % or em? [duplicate]

There’s a really good article on web typography on A List Apart. Their conclusion: Sizing text and line-height in ems, with a percentage specified on the body (and an optional caveat for Safari 2), was shown to provide accurate, resizable text across all browsers in common use today. This is a technique you can put … Read more

Specify width in *characters*

ch unit The unit you’re looking for is ch. According to the MDN docs: ch: Represents the width, or more precisely the advance measure, of the glyph “0” (zero, the Unicode character U+0030) in the element’s font. It is supported in current versions of major browsers (caniuse). Example pre { width: 80ch; /* classic terminal … Read more

CSS: 100% font size – 100% of what?

The browser default which is something like 16pt for Firefox, You can check by going into Firefox options, clicking the Content tab, and checking the font size. You can do the same for other browsers as well. I personally like to control the default font size of my websites, so in a CSS file that … Read more

How to adjust text font size to fit textview

The solution below incorporates all of the suggestions here. It starts with what was originally posted by Dunni. It uses a binary search like gjpc’s, but it is a bit more readable. It also include’s gregm’s bug fixes and a bug-fix of my own. import android.content.Context; import android.graphics.Paint; import android.util.AttributeSet; import android.util.TypedValue; import android.widget.TextView; public … Read more

Change font size macvim?

The default font is Bitstream Vera (search for ‘default font’ on that page). So why not just specify that, but with a different font size? E.g. :set guifont=Bitstream\ Vera\ Sans\ Mono:h14 This approach also ensures that if in future the default changes (e.g. to the system default, Monaco), you will still have your preferred font … Read more

Change font size of UISegmentedControl

I ran into the same issue. This code sets the font size for the entire segmented control. Something similar might work for setting the font type. Note that this is only available for iOS5+ Obj C: UIFont *font = [UIFont boldSystemFontOfSize:12.0f]; NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; [segmentedControl setTitleTextAttributes:attributes forState:UIControlStateNormal]; EDIT: UITextAttributeFont has been deprecated … Read more

Auto-fit TextView for Android

Thanks to MartinH’s simple fix here, this code also takes care of android:drawableLeft, android:drawableRight, android:drawableTop and android:drawableBottom tags. My answer here should make you happy Auto Scale TextView Text to Fit within Bounds I have modified your test case: @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ViewGroup container = (ViewGroup) findViewById(R.id.container); findViewById(R.id.button1).setOnClickListener(new … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)