positioning

Retrieving DOM textnode position

Hi, Is it possible to retrieve the geometric position (i.e. top/left offsets from either the parent element, the page, etc) of a text node? ...

html <input> element ignores CSS left+right properties?

Hi, I've noticed that the <input> element in HTML ignores the CSS pair of "left" and "right" properties. Same for the pair "top" and "bottom". See the sample code below: <html> <head> <style><!-- #someid { position: absolute; left: 10px; right: 10px; top: 10px; bottom: 10px; } --></...

IE not autosizing width of absolutely positioned element

When I specify a "height" in the style for any element inside of this, IE makes the entire thing 100% width, rather than keeping it "autosized" for width. Other browsers display it fine, but not IE. How do I fix this? <div style="position:absolute;top:50px;left:50px;background:green;"> <div> <div>test</div> <div style="height: 20...

Position div depending on distance browser edge (javascript)

I am trying to create a small tooltip script that mostly relies on css. The bit of JavaScript I can't figure out is how to position the div based on its distance to the browsers edge. When the div appears I would like it to check how close it is to the top, bottom, left and right. For example if there is not enough space to display the ...

Determining position of the browser window in JavaScript?

For various silly reasons, I'd like to be able to detect the rectangle of the browser window on screen. Title bar and all. Is this possible, or is JavaScript limited to the view port of its page? Edit: I may have been unclear, but view port is the portion of the page that's visible in the window. This may not be a term commonly used w...

Determining allowable moves on a grid

Can anyone suggest a suitable way of figuring out a pieces allowable moves on a grid similar to the one in the image below. Assuming piece1 is at position a1 and piece2 is at position c3, how can I figure out which grid squares are allowable moves if piece1 can move (say) 3 squares and piece2 can move 2? I've spent way too long devel...

HTML List Problem

Dear all, I am making a list with heading and subheading, my main list Home1, followed by subheading. How can I exactly position the subheading content without affecting another list? Any idea? <div id="wrapper"> <ul id="testnav"> <li> <a href="#">Home</a> <ul id="subnav"> <div style...

CSS same-line aligning

Is there an elegant way to align 3 elements left, center, and right on the same line? Right now I'm using 3 <div>'s all with width:33%;float:left; and it's not working too well. ...

JavaScript/jQuery - offsetLeft and offsetTop

When hovering over a span I would like to get the offsetLeft and offsetTop values so I can make something hover near it. When I do this I get 0 for both values. What is a better way to tackle this? I am using jQuery. Assume I am starting with (looped by server-side scripting): <span onmouseover="hoverNearMe(this.offsetLeft,this.offs...

Need two div's to line up correctly

Here is a screenshot of how both div's lineup: http://tinyurl.com/d3kopn The left column is , the div that I want to line up to the right of it is And both those div's are within .content-body { padding:10px 15px; font-size:.8em; font-family:arial; overflow:auto; } .col-left { float:left; position:relative; ...

How do I dynamically position a swf in flex relative to its parent container?

How do I position a child relative to its containing box? The Code: <mx:Script> <![CDATA[ thisMap.scaleX = scaleFactor; thisMap.scaleY = scaleFactor; thisMap.x = thisMap.x - thisMap.mouseX * 1.3; thisMap.y = thisMap.y - thisMap.mouseY * 1.3; ]]> </mx:Script> <mx:Box id="mapHolder" x="0" y="30"> ...

Relatively positioned object inside a YUI layout with IE

I'm using YUI to create a 3 column layout like so: ===================== = = ===================== = s = = = i = = = d = = = e = body = = b = = = a = = = r = = ===================== The sidebar is scrollable (that is, t...

Position element in the middle of the screen after scrolling

my page is 2x the height of the screen (size varies depending on other item on the page). i want to show an absolutely positioned SPAN in the middle of the screen regardless of scroll position. i apply the following style on button click, however if i scroll all the way down, the element shows up at the very top of the page since it cou...

How do you programatically position an object in Silverlight?

In Flash this question is answered really easy because you can set the X and Y coordinates of an object: newxpos = object._x; newypos = object._y; How do you do the same in Silverlight? ...

How do you dynamically place a control on a canvas in Silverlight?

I'm trying to place a control that I have created on my canvas. The idea is to be able to dynamically add them on the fly. Like on a button click or at the end of a DispatchTimer. I have the following, but it doesn't work: FirstCircleControl mc = new FirstCircleControl(); Canvas.SetLeft(mc, 100); Canvas.SetTop(mc, 100); ...

Is there a way to specify overflow in CSS?

I have been using a lot of 'position:relative;' in my design, I just find it the easiest way to get everything where I need them to be. However, the more items I add on my site (each one with their individual div) each one ends up further and further at the bottom of my page, so I have to manually position them higher. This leaves a lo...

How do I position an element within a WPF Grid column?

Let's say I want to position an element at the coordinates x=20, y=5 within the 3rd column of a Grid control. How do I do this? Do I need to add a Canvas panel to the column and then add the controls to it? Thanks. ...

auto width of the error label

the error label displays till the width of the table. as this: how can i display it till the text of the label? this is the css: label.error { color: red; font-size:16px; font-family:Nyala; background-color: #FFFFCC; display:block; width:auto; } ...

Qt: how to set main window's initial position?

I think the normally window manager determines the initial position of the QMainWindow position on the desk top. I want to set the initial position myself. How is this done with Qt on Windows? ...

Positioning in java swing

I have some troubles with positioning my label/password field. With this code they both get positioned in the center next to each other, while I actually want them in the middle of my panel on top of each other. Does anyone know how I should do that? import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.ImageIcon...