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.

8627 questions
5037
votes
131 answers

How can I horizontally center an element?

How can I horizontally center a
within another
using CSS?
Foo foo
Lukas
  • 9,476
  • 4
  • 20
  • 14
3671
votes
19 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
  • 43,096
  • 5
  • 36
  • 32
2236
votes
26 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
  • 22,913
  • 3
  • 21
  • 14
1877
votes
40 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
  • 19,119
  • 11
  • 33
  • 40
1646
votes
49 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
  • 19,630
  • 7
  • 36
  • 56
946
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
  • 101,809
  • 122
  • 424
  • 632
695
votes
15 answers

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

What is the difference between align-items and align-content?
Dinh
  • 7,081
  • 3
  • 13
  • 3
621
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
541
votes
27 answers

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 tabs? * { box-sizing: border-box; } #leftFrame…
shuji
  • 7,369
  • 7
  • 34
  • 49
452
votes
21 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
  • 109,619
  • 77
  • 317
  • 330
440
votes
19 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
  • 6,414
  • 11
  • 42
  • 55
404
votes
5 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
  • 23,180
  • 45
  • 124
  • 206
310
votes
14 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
  • 166,356
  • 226
  • 505
  • 746
272
votes
8 answers

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 divisible by 4), as it's the case with aligned addresses?
Daar
  • 3,385
  • 4
  • 20
  • 18
249
votes
21 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
  • 15,211
  • 52
  • 164
  • 258
1
2 3
99 100