Linked Questions

977 votes
27 answers
3.3m views

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
751 votes
21 answers
1.2m views

I'm trying to horizontally center a <div> block element on a page and have it set to a minimum width. What is the simplest way to do this? I want the <div> element to be inline with rest ...
cmcginty's user avatar
  • 118k
220 votes
27 answers
697k views

I suppose that the #container will be centered within #main_content. However, it is not. Why isn't this working, and how can I fix it? #main_content { top: 160px; left: 160px; width: 800px; ...
user2142709's user avatar
  • 2,703
86 votes
9 answers
334k views

http://twitter.github.com/bootstrap/scaffolding.html I tried like all combinations: <div class="row"> <div class="span7 offset5"> box </div> </div> or <div class="...
Alex's user avatar
  • 66.6k
41 votes
10 answers
58k views

I'm trying to center a <div> horizontally. I already have text-align: center; on the <div> itself, but it does not work. Any suggestions?
Luuk's user avatar
  • 883
87 votes
4 answers
265k views

Possible Duplicate: How to horizontally center a div? One simple way to make an object centered in HTML is using align='center', but it's not working for a div. I tried: style='text-align:...
Mac Taylor's user avatar
  • 5,178
41 votes
1 answer
73k views

Why is my screenshot image not centered on the screen? My css so far is this: <section class="hero container max-w-screen-lg mx-auto text-center pb-10"> <div class=""> &...
Blankman's user avatar
  • 269k
21 votes
7 answers
28k views

I want to center a div in the middle of my page, and have the div fit the contents. How can I do that? I've tried width: 1px; white-space: nowrap; margin: 0 auto; Which centers the div, but then all ...
mpen's user avatar
  • 285k
14 votes
7 answers
117k views

when i use top:50% and left:50% the box is not directly in center. of course when the box is very small, it appears to be centered. but when box is a bit big, it looks as if it's not centered. how ...
aoghq's user avatar
  • 1,447
20 votes
2 answers
71k views

I am trying to vertically center two <p> elements. I followed the tutorial at phrogz.net but still the elements get placed above the div, below the div, top-aligned within the div. I would try ...
Romuloux's user avatar
  • 1,222
29 votes
7 answers
3k views

I know this question has been frequently asked but I can never seem to get it to work. Can you tell me what's wrong? I have three divs within a #container div, which I want to centre side by side. ...
nil338's user avatar
  • 315
18 votes
7 answers
9k views

Here is the source code: <div id = "outer"> <div id="top"> .... </div> <div id="inner"> .... </div> <...
Tattat's user avatar
  • 15.8k
22 votes
2 answers
14k views

Possible Duplicate: How to center DIV in DIV? Please take a look at the image below: How can I make the grey squares horizontally centered inside the red container div? This is all made with ...
user avatar
23 votes
5 answers
6k views

Possible Duplicate: How to center DIV in DIV? Now i try <html> <head> <title>?????????????????</title> <style type="text/css"> body { ...
John Nall's user avatar
  • 849
1 vote
2 answers
57k views

I want to center a div without centering its children like so: <center> <div> <h1>Hello World!</h1> </div> </center> As you can see I only want the div to be ...
dyari's user avatar
  • 75

15 30 50 per page
1
2 3 4 5
50