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.

In GUI (inc. web page) context, alignment refers to the positioning of visual elements. Three possibility of alignment left, right, and center.

In a memory addressing context, alignment is the placement of data or code at memory addresses that are multiples of some (usually small) power of 2, for example having an array start at a 16-byte boundary with C++ alignas(16) int foo[1024];. This means the address will end with at least 4 0 bits.

For this meaning, prefer the tag.

7934 questions
4623
votes
121 answers

How to horizontally center an element

How can I horizontally center a
within another
using CSS?
Foo foo
Lukas
  • 9,486
  • 4
  • 18
  • 14
3473
votes
30 answers

Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and cellspacing can be set like this: How can the same be accomplished using CSS?
kokos
  • 40,828
  • 5
  • 32
  • 32
2080
votes
23 answers

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; }
small img Doesn't work.
sam
  • 21,293
  • 3
  • 18
  • 14
1802
votes
39 answers

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 correctly in Safari (usually using vertical-align:…
One Crayon
  • 18,759
  • 9
  • 30
  • 38
1471
votes
46 answers

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.
Div to be aligned vertically
How can I…
Burak Erdem
  • 17,724
  • 7
  • 32
  • 54
878
votes
27 answers

How to align a

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
  • 92,920
  • 119
  • 388
  • 596
565
votes
30 answers

Best way to center a

Best way to center a
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 it vertically, too?
J-Dog
448
votes
11 answers

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

Can anybody show me the difference between align-items and align-content?
Dinh
  • 4,611
  • 3
  • 10
  • 3
431
votes
18 answers

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 center of the screen, but for some reason I can…
Konstantin Rusanov
  • 5,926
  • 9
  • 33
  • 51
420
votes
19 answers

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 after resizing the container. So I…
serg
  • 103,023
  • 70
  • 299
  • 324
277
votes
3 answers

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 flexbox I have one block of code. With float I have four…
Jens Törnell
  • 18,167
  • 36
  • 100
  • 168
267
votes
12 answers

How to center an iframe horizontally?

Consider the following example: (live demo) HTML:
div
CSS: div, iframe { width: 100px; height: 50px; margin: 0 auto; background-color: #777; } Result: Why the iframe is not centrally aligned like the…
Misha Moroshko
  • 148,413
  • 200
  • 467
  • 700
238
votes
10 answers

UILabel Align Text to center

How do I align text in UILabel?
vivianaranha
  • 2,659
  • 6
  • 31
  • 45
229
votes
19 answers

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
  • 14,035
  • 48
  • 151
  • 235
224
votes
20 answers

How to right align widget in horizontal linear layout Android?

This is the code I am using and it is not working:
awareeye
  • 2,831
  • 3
  • 19
  • 22
1
2 3
99 100