positioning

Position floated elements directly under each other [duplicate]

丶灬走出姿态 提交于 2019-11-29 10:51:45
This question already has an answer here: CSS Floating Divs with different height are aligned with space between them 3 answers I would like to display a row of tow divs next to each other while in the next row, the next div sits directly under the last one. Like this: Because the layout has to be built into an CMS, I can't put Box 1,3 and 2,4 in a separat div. Is there a way to achieve this kind of behavior without extra wrapping elements? (Normal float behavior doesn't work, display inline/inline-block also doesn't do the trick.) Or is some JavaScript required to build a layout like this?

C# window positioning

混江龙づ霸主 提交于 2019-11-29 10:04:05
Using Windows Forms I wanted to position window into specific coords. I thought it can be done in a simple way, but following code does not work at all: public Form1() { InitializeComponent(); this.Top = 0; this.Left = 0; } However, when only get a handle to that window, it works well: public Form1() { InitializeComponent(); IntPtr hwnd = this.Handle; this.Top = 0; this.Left = 0; } You can see that I am not working with that pointer at all. I found at MSDN following statement: The value of the Handle property is a Windows HWND. If the handle has not yet been created, referencing this property

Extend child div beyond container div

狂风中的少年 提交于 2019-11-29 09:15:17
I'm trying to expand this div across with width of the browser. I've read from here that you can use {position:absolute; left: 0; right:0;} to achieve that as in the jsfiddle here: http://jsfiddle.net/bJbgJ/3/ But the problem is that my current #container has a {position:relative;} property, and hence if I apply {position:absolute} to the child div, it would only refer to #container . Is there a way to still extend my child div beyond the #container ? I can think of five ways to potentially accomplish your goal: Use negative margins on the inner element to move it outside of the parent Use

DIV next to centered div

时间秒杀一切 提交于 2019-11-29 07:17:06
body { background: rgba(0, 0, 0, 0.8); font-family: sans-serif; font-size: 11px; color: #e0e0e0; } #wrapper { } #login { margin-left: auto; margin-right: auto; margin-top: 50px; background: rgba(0, 0, 0, 0.9); width: 360px; padding: 20px; position: relative; -webkit-border-radius: 15px; border-radius: 15px; } #registercontainer { position: relative; margin-left: auto; margin-right: auto; width: 1050px; } #register { position: absolute; left: 740px; top: 50px; } // <div id="wrapper"> <div id="login"> <h2>Login to The Something Project</h2> <form action="game" method="post"> <input type="text"

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

倖福魔咒の 提交于 2019-11-29 05:44:29
问题 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; } --></style> </head> <body> <input type="text" id="someid" value="something"/> </body> </html> The <input> should take up almost all space in the browser (except a border of 10px around it). It works fine in Safari, but in

CSS dropdown nav causing html content to move

末鹿安然 提交于 2019-11-29 04:33:05
my first question on SO, hope it's up to scratch, should be a simple solve for somebody well versed in the art of css... The problem im having is that the dropdown sections of my css-driven navigation are causing the content below it to shift to the right. I have found similar-ish questions posted but I have tried all provided solutions and nothing seems to get it working..... The closest I have managed to get is to add position:absolute; to the #nav li:hover ul tag, and this does stop the content from moving around, but creates a new problem, the dropdown submenu is only visible when the

Show Dialog box at center of its parent

放肆的年华 提交于 2019-11-29 02:04:36
问题 It's been a mess to show a DialogBox at the center of its parent form. Here is a method to show a dialog. I am positioning its parent to center but not able to center the DialogBox private void OpenForm(Object point, Object height, Object width) { FormLoading frm = new FormLoading(); Point temp = (Point)point; Point location = new Point(temp.X + (int)((int)width) / 2, temp.Y + (int)((int)height) / 2); frm.Location = location; frm.ShowDialog(); } private void btnView_Click(object sender,

What would make offsetParent null?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 01:37:52
I am trying to do positioning in JavaScript. I am using a cumulative position function based on the classic quirksmode function that sums offsetTop and offsetLeft for each offsetParent until the top node. However, I am running into an issue where the element I'm interested in has no offsetParent in Firefox. In IE offsetParent exists, but offsetTop and offsetLeft all sum up to 0, so it has the same problem in effect as in Firefox. What would cause an element that is clearly visible and usable on the screen to not have an offsetParent ? Or, more practically, how can I find the position of this

How to make inner div use window scroll bar?

老子叫甜甜 提交于 2019-11-28 23:34:38
I'd like to use a div within my page that does not take up the whole screen use the scroll bars on the edge of the screen when its content overflows. I know that sounds confusing, so here's an example: http://www.csszengarden.com/?cssfile=/202/202.css&page=1 I would have posted code, but I'm not sure where to start on that. Could someone point me in the right direction with the HTML & CSS? One trick is to overlay one or more static images or boxes and fix their position, then resize the scrollable area of your entire page, your inner <div> , such that its width fits in the "viewable area"

CSS position:fixed inside a positioned element

天大地大妈咪最大 提交于 2019-11-28 19:25:14
问题 I have a positioned div whose content can be too long so scrollbars appear ( overflow:auto set). It functions as a dialog box in an ajax app. I want to fix a close button on it's right top corner so when the user scrolls the div it won't scroll away. I tryed it with position:fixed; right:0; top:0 but it placed the button on the right top of the page not in the div (in firefox). Is it possible to do this button placement using CSS only without hacking with the offsetWidth/Height in js on every