How to center absolutely positioned element in div?

How to center absolutely positioned element in div?

I need to place a div (with position:absolute;) element in the center of my window. But I am having problems doing so, because the width is unknown.I tried this. But it needs to be adjusted as the width is responsive..center { left: 50%;

Why is there an unexplainable gap between these inline-block div elements?

Why is there an unexplainable gap between these inline-block div elements?

I have two inline-block div elements, that are the same, positioned next to eachother. However there seems to be a mysterious space of 4 pixels between the two divs despite the margin being set to 0. There are no parent divs effecting them

Can I use a :before or :after pseudo-element on an input field?

Can I use a :before or :after pseudo-element on an input field?

I am trying to use the :after CSS pseudo-element on an input field, but it does not work. If I use it with a span, it works OK. This works (puts th

How do I create a transparent Activity on Android?

How do I create a transparent Activity on Android?

I want to create a transparent Activity on top of another activity.How can I achieve this? 1:Add the following style in your res/values/styles.xml file (if you don’t have one, create it.) Here’s a complete file:<?xml version="1.0" encodi

event.preventDefault() vs. return false

event.preventDefault() vs. return false

When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well:1. event.preventDefault()$('a').click(function

Get git current branch/tag name

Get git current branch/tag name

How can I get the current branch or tag name for my working copy? I have seen references that indicate rev-parse --abbrev-ref HEAD will give branch name, but this doesn't work if the checkout is of a tag, in which case it just returns 'HEA

Google static map API getting 403 forbidden when loading from img tag

Google static map API getting 403 forbidden when loading from img tag

What I have is a Google map that shows the location of a property but when I come to print the dynamic maps dont print so good so I decided to implement the Google Static Map image API.http://lpoc.co.uk/properties-for-sale/property/oldgate-

Media Queries: check min-height and min-width?

Media Queries: check min-height and min-width?

I am trying to change CSS on my page based on the min-height and min-width of the browser, so I am using this:@media (min-height: 500px), (min-width: 580px) { /* CSS stuff */}But for some reason, this doesn't work. I can check for min-he

XPath expression to find elements whose tag name contains 'Name'

XPath expression to find elements whose tag name contains 'Name'

I am a newcomer to XPath.I am looking for a way to get all elements whose tag name contains a particular string.For example, if I have XML like below, I want to get all the elements whose tag name contains the word 'Name'. i.e., I want to f

Asp.Net MVC3 RC Razor views : syntax for embedding code inside  block

Asp.Net MVC3 RC Razor views : syntax for embedding code inside block

Having trouble embedding c# code inside a javascript block with MVC3 RC1 razor view. What syntax should I use to make this working? I get warnings eg. Expected constant on the isOk variable among other. (Without text tag, the following code

fb:like-box, custom css?

fb:like-box, custom css?

Is it possible to add a custom css file to a fb:like-box? For example, I would like to remove the borders around the iframe. Thanks 1:The new like-box does not accept the "css" attribute. You have to use the old fb:fan plugin to achieve

How to use placeholders instead of labels in simple_form?

How to use placeholders instead of labels in simple_form?

I want to use placeholders everywhere in my application instead of labels. I am using simple_form and Rails (3.2.14). How can I specify in simple_form config file to use placeholders instead of labels.In Initializers there is a file simple_

UIButton in Swift is not registering touches

UIButton in Swift is not registering touches

I'm trying to create a UIButton using Swift. It compiles fine and I can see my button in the simulator, but when I click it, nothing happens. This is the code I am using:let settings = UIButton()settings.addTarget(self, action: "touchedSet:

How to add confirm message with link_to Ruby on rails

How to add confirm message with link_to Ruby on rails

I wanted to add confirmation message on link_to function with Ruby.= link_to 'Reset message', :action=>'reset' ,:confirm=>'Are you sure?'Any ideas why it's not working? 1:First, you should verify that your layout have jquery_ujs.Best pr

what is the query to get “related tags” like in stack overflow

what is the query to get “related tags” like in stack overflow

i have 3 tables:links (id, linkName) tags (id, tagName) tagsBridge (tagID, linkID) i am trying to support showing related tags like in SOF. so if you click on tags "XYZ", right now i am showing all the links with tag "XYZ" but i also wa

CSS property value from class name

CSS property value from class name

It is possible to pass parameters for CSS in class name? For example:.mrg-t-X { margin-top: Xpx;}TestIn this example X should be 10. 1:No it isn't. The closest we have to this is the attr() function, but that only works within the cont

Using ANTLR to parse a log file

Using ANTLR to parse a log file

I'm just about starting with ANTLR and trying to parse some pattern out of a log filefor example: log file: 7114422 2009-07-16 15:43:07,078 [LOGTHREAD] INFO StatusLog - Task 0 input : uk.project.Evaluation.Input.Function1(selected=["r

What is the best way to structure an HTML document for SEO and accessibility?

What is the best way to structure an HTML document for SEO and accessibility?

What's the recommended way to structure html that includes navigation so it's still SEO'able and accessible.For example, should the structure be more like that of a document:Skip to content (link, hidden by CSS)NavigationContentOther conten

Base URL in ASP.net Master Pages with virtual Directories

Base URL in ASP.net Master Pages with virtual Directories

I have an ASP.net master page. In this master, I have all my css and javascript files defined. I also have a few images and a few buttons and hyperlinks.All the urls are all declared as relative ie "/scripts/ian.js"Everything works fine if

Read logcat programmatically for an application

Read logcat programmatically for an application

I've read this article already. But it seems most of the text it shows are not in my application. How can I filter the message and let it only shows the log for my application. In another word, I want to show it like the one in Android Stud

Any gotchas with objc_setAssociatedObject and objc_getAssociatedObject?

Any gotchas with objc_setAssociatedObject and objc_getAssociatedObject?

I’m looking into ways to add a property (an integer in this case) to all UIView instances, whether they are subclassed or not. Is using objc_setAssociatedObject() and objc_getAssociatedObject() within a category the appropriate, Apple-endor

Are there alternatives to Google Cloud Messaging for custom android builds? [closed]

Are there alternatives to Google Cloud Messaging for custom android builds? [closed]

We have a custom android build and just figured out the Google Cloud Messaging (GCM) maybe an issue on non Google certified builds.Assuming that is the case, are there any alternatives out there to GCM? 1:Easiest way to implement push no

Composer: how to install `dev` packages in Symfony 2.3?

Composer: how to install `dev` packages in Symfony 2.3?

Trying to install the KnpGaufretteBundle in a Symfony 2.3 project, I'm having no luck. The problem is:minimum-stability:stable (in composer.json);the bundle I require is dev-master version still.Reading this in the Symfony docs was frustrat

BroadcastReceiver declared in manifest is not receiving the Broadcast

BroadcastReceiver declared in manifest is not receiving the Broadcast

I've tried to register a Wifi BroadcastReceiver to get the wifi state when it changes. But so far I have no luck receiving the broadcast. //activity declaration here...Do you guys know how

Android xml merge layout error on inflate

Android xml merge layout error on inflate

I have a CustomView class and I want to use xml layout for it. So, my class extends RelativeLayout, inflates xml layout and tries to attach it to self. public class CustomView extends RelativeLayout{ public CustomView (Context context) {