Questions tagged [layout]

The layout tag is for questions about the placement, alignment and justification of objects with respect to a containing element. For questions pertaining to CSS, use the 'css' tag instead.

In computing, layout is the process of calculating the position of objects in space subject to various constraints. This functionality can be part of an application or packaged as a reusable component or library.

Android Development Examples:

HTML Examples:

26721 questions
2418
votes
21 answers

Get the size of the screen, current web page and browser window

How can I get windowWidth, windowHeight, pageWidth, pageHeight, screenWidth, screenHeight, pageX, pageY, screenX, screenY which will work in all major browsers?
turtledove
  • 25,464
  • 3
  • 23
  • 20
1960
votes
46 answers

How to get screen dimensions as pixels in Android

I created some custom elements, and I want to programmatically place them to the upper right corner (n pixels from the top edge and m pixels from the right edge). Therefore I need to get the screen width and screen height and then set position: int…
Niko Gamulin
  • 66,025
  • 95
  • 221
  • 286
1077
votes
10 answers

What is a clearfix?

Recently I was looking through some website's code, and saw that every
had a class clearfix. After a quick Google search, I learned that it is for IE6 sometimes, but what actually is a clearfix? Could you provide some examples of a layout…
H Bellamy
  • 22,405
  • 23
  • 76
  • 114
1066
votes
15 answers

How do you keep parents of floated elements from collapsing?

Although elements like
s normally grow to fit their contents, using the float property can cause a startling problem for CSS newbies: If floated elements have non-floated parent elements, the parent will collapse. For example:
Nathan Long
  • 122,748
  • 97
  • 336
  • 451
789
votes
29 answers

Using jQuery to center a DIV on the screen

How do I go about setting a
in the center of the screen using jQuery?
Craig
  • 36,306
  • 34
  • 114
  • 197
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
684
votes
30 answers

Android Drawing Separator/Divider Line in Layout?

I would like to draw a line right in the middle of a layout and use it as a separator of other items like TextView. Is there a good widget for this. I don't really want to use an image as it would be hard to match the other components to it. And I…
Androider
  • 21,125
  • 36
  • 99
  • 158
634
votes
21 answers

How to make layout with rounded corners..?

How can I make a layout with rounded corners? I want to apply rounded corners to my LinearLayout.
Addy
  • 6,363
  • 3
  • 14
  • 13
546
votes
16 answers

How to set Bullet colors in UL/LI html lists via CSS without using any images or span tags

Imagine a simple unsorted list with some
  • items. Now, I have defined the bullets to be square shaped via list-style:square; However, if I set the color of the
  • items with color: #F00; then everything becomes red! While I only want to set…
  • Sam
    • 15,254
    • 25
    • 90
    • 145
    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
    515
    votes
    13 answers

    How can I expand floated child div's height to parent's height?

    I have the page structure as:
    Now, the child-left DIV will have more content, so the parent DIV's height increases as…
    Veera
    • 32,532
    • 36
    • 98
    • 137
    484
    votes
    29 answers

    Android: How do I prevent the soft keyboard from pushing my view up?

    I have a vertical sliding drawer at the bottom of my app. When the soft keyboard opens, it pushes the tab for the drawer up, so it sits atop the keyboard. I actually want it to remain at the bottom of the screen, becoming hidden when the keyboard is…
    Christopher Perry
    • 38,891
    • 43
    • 145
    • 187
    411
    votes
    19 answers

    how to read value from string.xml in android?

    I have written the line: String Mess = R.string.mess_1 ; to get string value, but instead of returning string, it is giving me id of type integer. How can I get its string value? I mentioned the string value in the string.xml file.
    UMAR-MOBITSOLUTIONS
    • 77,236
    • 95
    • 209
    • 278
    378
    votes
    35 answers

    How do I put the image on the right side of the text in a UIButton?

    I don't want to use a subview if I can avoid it. I want a UIButton with a background image, text, and an image in it. Right now, when I do that, the image is on the left side of the text. The background image, text, and image all have different…
    jasongregori
    • 11,451
    • 5
    • 43
    • 41
    361
    votes
    21 answers

    Center a button in a Linear layout

    I am using a linear layout to display a pretty light initial screen. It has 1 button that is supposed to centre in the screen both horizontally and vertically. However no matter what I try to do the button will top align centre. I have included…
    themaninthesuitcase
    • 4,771
    • 5
    • 25
    • 34
    1
    2 3
    99 100