Easiest way to vertically centre an element in CSS

I’ve used many different ways to centre an element in CSS, this is the best way I’ve found so far (with bootstrap also). The above applied to the containing element centres itself and is responsive.

XML Serialization quick and easy csharp

Serialization with XML and C# this is mainly here as a reminder for me on how to do it! To serialize to a file: using System.Xml; using System.Xml.Serialization; // other code List mylist = this.getList(); Type stype = typeof(List); var serializer = new XmlSerializer(stype); XmlWriterSettings settings = new XmlWriterSettings(); settings.OmitXmlDeclaration = true; // this is XML Serialization quick and easy csharp

Bootstrap compatible asp.net button

Similar to my previous post, you can use the following code to create a custom asp.net button with the ‘button’ tags used in HTML5 and bootstrap. [ParseChildren] public class bsButton : Button { private string _ButtonCss = “btn btn-default”; [Browsable(true), Description(“The css class”),] public string ButtonCss { get { return _ButtonCss; } set { _ButtonCss Bootstrap compatible asp.net button

Calculate a fraction in javascript

Calculating a fraction from a double in javascript The following code will allow you to calculate a fraction in javascript function getFraction(dblValue, dblTolerance) { var f0 = 1 / dblValue; var f1 = 1 / (f0 – Math.floor(f0)); var a_t = Math.floor(f0); var a_r = Math.round(f0); var b_t = Math.floor(f1); var b_r = Math.round(f1); var Calculate a fraction in javascript