Skip to main content

Questions tagged [alignment]

In GUI (inc. web page) context, alignment refers to the positioning of visual elements. Or for memory addresses, being a multiple of some power of 2.

Filter by
Sorted by
Tagged with
5105 votes
128 answers
4.9m views

How can I horizontally center an element?

How can I horizontally center a <div> within another <div> using CSS? <div id="outer"> <div id="inner">Foo foo</div> </div>
3700 votes
19 answers
2.7m views

Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and cellspacing can be set like this: <table cellspacing="1" cellpadding="1"> How can the same be accomplished using CSS?
kokos's user avatar
  • 43.4k
2259 votes
26 answers
1.6m views

Vertically align text next to an image?

Why won't vertical-align: middle work? And yet, vertical-align: top does work. span{ vertical-align: middle; } <div> <img src="https://via.placeholder.com/30" alt="small img" /> ...
sam's user avatar
  • 23.2k
1886 votes
40 answers
1.2m views

How to align checkboxes and their labels consistently cross-browsers

This is one of the minor CSS problems that plague me constantly. How do folks around Stack Overflow vertically align checkboxes and their labels consistently cross-browser? Whenever I align them ...
1667 votes
50 answers
1.9m views

How can I vertically center a div element for all browsers using CSS?

I want to center a div vertically with CSS. I don't want tables or JavaScript, but only pure CSS. I found some solutions, but all of them are missing Internet Explorer 6 support. <body> <...
Burak Erdem's user avatar
  • 19.8k
962 votes
27 answers
3.2m views

How to align a <div> to the middle (horizontally/width) of the page [duplicate]

I have a div tag with width set to 800 pixels. When the browser width is greater than 800 pixels, it shouldn't stretch the div, but it should bring it to the middle of the page.
Shimmy Weitzhandler's user avatar
748 votes
15 answers
346k views

What's the difference between align-content and align-items?

What is the difference between align-items and align-content?
Dinh's user avatar
  • 7,611
630 votes
30 answers
1.2m views

Best way to center a <div> on a page vertically and horizontally? [duplicate]

Best way to center a <div> element on a page both vertically and horizontally? I know that margin-left: auto; margin-right: auto; will center on the horizontal, but what is the best way to do ...
user avatar
558 votes
28 answers
541k views

How to center an element horizontally and vertically

I am trying to center my tabs content vertically, but when I add the CSS style display:inline-flex, the horizontal text-align disappears. How can I make both text alignments x and y for each of my ...
shuji's user avatar
  • 7,474
453 votes
21 answers
1.0m views

How to align 3 divs (left/center/right) inside another div?

I want to have 3 divs aligned inside a container div, something like this: [[LEFT] [CENTER] [RIGHT]] Container div is 100% wide (no set width), and center div should remain in center ...
serg's user avatar
  • 111k
442 votes
19 answers
919k views

Responsive image align center bootstrap 3

I do a catalog using Bootstrap 3. When displayed on tablets, the product images look ugly because of their small size (500x500) and a width of 767 pixels in the browser. I want to put the image in the ...
Konstantin Rusanov's user avatar
441 votes
7 answers
433k views

How can I align one item right with flexbox?

https://jsfiddle.net/vhem8scs/ Is it possible to have two items align left and one item align right with flexbox? The link shows it more clearly. The last example is what I want to achieve. In ...
Jens Törnell's user avatar
317 votes
14 answers
718k views

How to center an iframe horizontally?

Consider the following example: (live demo) HTML: <div>div</div> <iframe></iframe> CSS: div, iframe { width: 100px; height: 50px; margin: 0 auto; background-...
Misha Moroshko's user avatar
284 votes
8 answers
124k views

Purpose of memory alignment

Admittedly I don't get it. Say you have a memory with a memory word of length of 1 byte. Why can't you access a 4 byte long variable in a single memory access on an unaligned address(i.e. not ...
Daar's user avatar
  • 3,505
268 votes
13 answers
455k views

How do I center text vertically and horizontally in Flutter?

I'd like to know how to center the contents of a Text widget vertically and horizontally in Flutter. I only know how to center the widget itself using Center(child: Text("test")) but not the ...
jeroen-meijer's user avatar
250 votes
21 answers
451k views

Right align text in android TextView

I have a TextView in my application. I want to align the text in it to the right. I tried adding: android:gravity="right" But this doesn't work for me. What might I be doing wrong?
Bishan's user avatar
  • 15.6k
247 votes
20 answers
276k views

How to right align widget in horizontal linear layout Android?

This is the code I am using and it is not working: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="...
awareeye's user avatar
  • 3,061
245 votes
10 answers
212k views

UILabel Align Text to center

How do I align text in UILabel?
vivianaranha's user avatar
  • 2,781
222 votes
8 answers
449k views

Format output string, right alignment

I am processing a text file containing coordinates x, y, z 1 128 1298039 123388 0 2 .... every line is delimited into 3 items using words = line.split() After processing ...
justik's user avatar
  • 4,245
194 votes
11 answers
90k views

Label Alignment in iOS 6 - UITextAlignment deprecated

Seems like UITextAlignmentCenter is deprecated in iOS 6. I still use it and works well, but it gives a warning. How can I fix this? label.textAlignment = UITextAlignmentCenter; Thanks.
user123's user avatar
  • 2,721
178 votes
19 answers
296k views

Center aligning a fixed position div

I'm trying to get a div that has position:fixed center aligned on my page. I've always been able to do it with absolutely positioned divs using this "hack" left: 50%; width: 400px; margin-...
Kyle's user avatar
  • 11k
176 votes
9 answers
214k views

Align items in a stack panel?

I was wondering if I can have 2 controls in a horizontal-oriented StackPanel so that the right item should be docked to the right side of the StackPanel. I tried the following but it didn't work: &...
Shimmy Weitzhandler's user avatar
173 votes
4 answers
415k views

Align <div> elements side by side

I know this is a rather simple question, but I can't figure it out for the life of me. I have two links which I've applied a background image to. Here's what it currently looks like (apologies for ...
sudo rm -rf's user avatar
  • 29.5k
173 votes
8 answers
473k views

Align labels in form next to input

I have very basic and known scenario of form where I need to align labels next to inputs correctly. However I don't know how to do it. My goal would be that labels are aligned next to inputs to the ...
Stan's user avatar
  • 26.3k
172 votes
5 answers
285k views

What is the Auto-Alignment Shortcut Key in Eclipse?

What is the auto-alignment shortcut key in Eclipse?
Praveen's user avatar
  • 91k
161 votes
17 answers
445k views

How to vertically center <div> inside the parent element with CSS? [duplicate]

I'm trying to make a small username and password input box. I would like to ask, how do you vertically align a div? What I have is: <div id="Login" class="BlackStrip floatright"> <div ...
Crays's user avatar
  • 2,508
150 votes
29 answers
229k views

How to center icon and text in a android button with width set to "fill parent"

I want to have an Android Button with icon+text centered inside it. I'm using the drawableLeft attribute to set the image, this works well if the button has a width of "wrap_content" but I need to ...
jloriente's user avatar
  • 1,531
150 votes
8 answers
53k views

Stacking Divs from Bottom to Top

When appending divs to a div with a fixed height, the child divs will appear from top to bottom, sticking at the top border. ┌─────────────────────────┐ │ Child Div 1 │ │ Child Div 2 ...
Wulf's user avatar
  • 3,898
148 votes
17 answers
660k views

How to align input forms in HTML

I'm new to HTML and I'm trying to learn how to use forms. The biggest issue I am having so far is aligning the forms. Here is an example of my current HTML file: <form> First Name:<input ...
yoshyosh's user avatar
  • 14k
146 votes
6 answers
635k views

Align button at the bottom of div using CSS

I want to align my button at the bottom right corner of my div. How can I do that? Current css of div: float: right; width: 83%; margin-right: 0px; font-family: Arial, Helvetica, ...
Harry Joy's user avatar
  • 59.4k
145 votes
5 answers
71k views

How do I vertically center UITextField Text?

I am simply instantiating a UITextField and noticing that the text doesn't center vertically. Instead, it is flush with the top of my button, which I find kind of odd since I would expect the default ...
Joey's user avatar
  • 7,527
120 votes
9 answers
1.0m views

trying to align html button at the center of the my page [duplicate]

I'm trying to align an HTML button exactly at the centre of the page irrespective of the browser used. It is either floating to the left while still being at the vertical centre or being somewhere on ...
user1455116's user avatar
  • 2,064
114 votes
40 answers
211k views

datatable jquery - table header width not aligned with body width

I am using jQuery datatables. When running the application, the header width is not aligned with the body width. But when I click on the header, it is getting aligned with the body width but even then ...
kishore's user avatar
  • 1,637
112 votes
11 answers
256k views

CSS: Center block, but align contents to the left

I want a whole block to be centered in its parent, but I want the contents of the block to be left aligned. Examples serve best On this page : http://yaml-online-parser.appspot.com/?yaml=%23+...
Paul Tarjan's user avatar
110 votes
3 answers
145k views

How to align single widgets in Flutter?

I want to align a Flutter widget within its parent. I know that I can center a widget by wrapping it in a Center widget. Center( child: Text("widget"), ) But how do I align it to the right, ...
Suragch's user avatar
  • 503k
109 votes
6 answers
246k views

How to label each equation in align environment?

I wonder how to label each equation in align environment? For example \begin{align} \label{eq:lnnonspbb} \lambda_i + \mu_i = 0 \\ \mu_i \xi_i = 0 \\ \lambda_i [y_i( w^T x_i + b) - 1 + \xi_i] = 0 \end{...
Tim's user avatar
  • 97.8k
107 votes
11 answers
292k views

CSS way to horizontally align table

I want to show a table of fixed width at the center of browser window. Now I use <table width="200" align="center"> But Visual Studio 2008 gives warning on this line: Attribute 'align' is ...
Alexander Prokofyev's user avatar
106 votes
7 answers
305k views

Center an item with position: relative

I've got a menu that appears on hover over an absolutely positioned div. All of the menu items have to be relatively positioned because the absolutely div will appear multiple times on a page and will ...
Flippinmonk's user avatar
  • 1,079
104 votes
9 answers
109k views

HorizontalAlignment=Stretch, MaxWidth, and Left aligned at the same time?

This seems like it should be easy but I'm stumped. In WPF, I'd like a TextBox that stretches to the width of it's parent, but only to a maximum width. The problem is that I want it to be left ...
Scott Bussinger's user avatar
98 votes
9 answers
172k views

How can I align text in columns using Console.WriteLine?

I have a sort of column display, but the end two column's seem to not be aligning correctly. This is the code I have at the moment: Console.WriteLine("Customer name " + "sales ...
Stephen Smith's user avatar
96 votes
1 answer
34k views

Difference between flex-end and end? [duplicate]

When I use the css property align-items, I cannot see any visual difference with the value of flex-end or value of end. What is the difference between align-items: end and align-items: flex-end?
Sølve's user avatar
  • 4,318
94 votes
9 answers
49k views

Can overflow text be centered?

When I specify text-align:center for an element with a width that is greater than the width of the text, the text is centered within the content box of the element (as expected). When I specify text-...
Nathan Ryan's user avatar
93 votes
7 answers
263k views

CSS - Make divs align horizontally

I have a container div with a fixed width and height, with overflow: hidden. I want a horizontal row of float: left divs within this container. Divs which are floated left will naturally push onto the ...
Robin Barnes's user avatar
  • 13.4k
91 votes
4 answers
214k views

Vertical alignment of text and icon in button

I'm having trouble vertically aligning a font-awesome icon with text within a button under the Bootstrap framework. I've tried so many things including setting the line-height, but nothing is working. ...
Shane's user avatar
  • 2,445
89 votes
7 answers
389k views

How to align footer (div) to the bottom of the page? [duplicate]

Can anyone explain how to align a footer div to the bottom of the page. From the examples I've seen, they all show how to make the div stay visible at the bottom, no matter where you've scrolled the ...
Joey Morani's user avatar
  • 26.2k
88 votes
7 answers
285k views

HTML-Tooltip position relative to mouse pointer

How to align the tooltip the natural style: right bottom of the mouse pointer? <!DOCTYPE html> <html> <head> <title>Tooltip with Image</title> <meta charset="UTF-...
Ben's user avatar
  • 1,618
82 votes
5 answers
98k views

Aligning controls on both left and right side in a stack panel in WPF

I have the following code: <DockPanel> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> <RadioButton Content="_Programs" IsChecked="{Binding ...
Michel Keijzers's user avatar
81 votes
3 answers
87k views

How do I make WPF ListView items repeat horizontally, like a horizontal scrollbar?

I have a WPF ListView which repeats the data vertically. I cannot figure out how to make it repeat horizontally, like the slideshow view in Windows Explorer. My current ListView definition is: <...
Ryan O'Neill's user avatar
  • 5,633
80 votes
11 answers
415k views

Center form submit buttons HTML / CSS

I'm having troubles centering my HTML form submit buttons in CSS. Right now I'm using: <input value="Search" title="Search" type="submit" id="btn_s"> <input value="I'm Feeling Lucky"...
Belgin Fish's user avatar
  • 19.7k
79 votes
8 answers
86k views

Android: How can you align a button at the bottom and listview above?

I want to have a button at the bottom of the listview. If I use relativeLayout/FrameLayout, it aligns but listView goes down to very botton. (Behind the button at the bottom) FrameLayout: <?xml ...
jclova's user avatar
  • 5,546

1
2 3 4 5
176