center

CSS: How to center text with surrounding borders

放肆的年华 提交于 2019-12-01 13:18:52
I am trying to center text that has a line going through the entire background. On either side of the text, there is some padding, where you cannot see the line at all. I am stumped as far as a good css-only way to go about this. Here is a jsfiddle that is obviously wrong, but its a start: http://jsfiddle.net/gtspk/ HTML <span class="line"> <h2>Latest Track</h2> </span> CSS .line{display:block; width:100%; border-bottom:1px solid red; margin-top:25px; text-align:center} .line h2{font-size:15px; text-align:center; position:relative; top:10px; padding:0 15px; display:inline-block; background

Vertical and Horizontal alignment of text with CSS [duplicate]

戏子无情 提交于 2019-12-01 12:57:43
This question already has an answer here: How to center an element horizontally and vertically 19 answers I'm trying to align a text, horizontally and vertically, inside a div box (with background color) but I'm not being able to do it. I've searched online and margin: auto , text-align: center aren't doing the work. Any tips? Check FIDDLE . HTML <div id="services"><div class="holder container clearfix"> <div class="bgtop"><span class="top">Corte cabelo + Afiar</span></div> <div class="bgprice"><span class="price">10€</span></div> </div></div> CSS #services .holder .bgtop{ background-color:

itextsharp PdfCopy and landscape pages

房东的猫 提交于 2019-12-01 12:37:20
I'm using itextsharp to join mutiple pdf documents and add a footer. My code works fine - except for landscape pages - it isn't detecting the page rotation - the footer is not centerd for landscape: public static int AddPagesFromStream(Document document, PdfCopy pdfCopy, Stream m, bool addFooter, int detailPages, string footer, int footerPageNumOffset, int numPages, string pageLangString, string printLangString) { CreateFont(); try { m.Seek(0, SeekOrigin.Begin); var reader = new PdfReader(m); // get page count var pdfPages = reader.NumberOfPages; var i = 0; // add pages while (i < pdfPages) {

itextsharp PdfCopy and landscape pages

与世无争的帅哥 提交于 2019-12-01 11:26:17
问题 I'm using itextsharp to join mutiple pdf documents and add a footer. My code works fine - except for landscape pages - it isn't detecting the page rotation - the footer is not centerd for landscape: public static int AddPagesFromStream(Document document, PdfCopy pdfCopy, Stream m, bool addFooter, int detailPages, string footer, int footerPageNumOffset, int numPages, string pageLangString, string printLangString) { CreateFont(); try { m.Seek(0, SeekOrigin.Begin); var reader = new PdfReader(m);

CSS: How to center text with surrounding borders

巧了我就是萌 提交于 2019-12-01 10:26:58
问题 I am trying to center text that has a line going through the entire background. On either side of the text, there is some padding, where you cannot see the line at all. I am stumped as far as a good css-only way to go about this. Here is a jsfiddle that is obviously wrong, but its a start: http://jsfiddle.net/gtspk/ HTML <span class="line"> <h2>Latest Track</h2> </span> CSS .line{display:block; width:100%; border-bottom:1px solid red; margin-top:25px; text-align:center} .line h2{font-size

Vertical and Horizontal alignment of text with CSS [duplicate]

被刻印的时光 ゝ 提交于 2019-12-01 10:04:46
问题 This question already has answers here : How to center an element horizontally and vertically (19 answers) Closed 5 years ago . I'm trying to align a text, horizontally and vertically, inside a div box (with background color) but I'm not being able to do it. I've searched online and margin: auto , text-align: center aren't doing the work. Any tips? Check FIDDLE. HTML <div id="services"><div class="holder container clearfix"> <div class="bgtop"><span class="top">Corte cabelo + Afiar</span><

Centering a variable-width grid after resizing the page

你说的曾经没有我的故事 提交于 2019-12-01 06:42:09
问题 Here is an image of what I want to do in CSS: image. Any ideas? 回答1: Initial issue Centering an element that has no explicit width This prevents the usual solution of margin: 0 auto; from being an option. Greater issue There's no unused space for centering the wrapper in its container An element is said to be shrink-wrapped if its width is determined by the width of its content. If the content changes in size, the width of the element changes likewise. This is the default behavior for

Equivalent to <center> tag in CSS? [duplicate]

人走茶凉 提交于 2019-12-01 03:12:34
This question already has an answer here: Why is the <center> tag deprecated in HTML? 17 answers I read that the <center> tag is deprecated, however I cannot find any real equivalent to it in CSS. text-align works for text but not other elements, and auto margins only work if you know the width of the container (so not a solution if you don't know the width in advance). So is there any real equivalent to this <center> tag? Mike Crawford text-align should work for other kinds of elements. Does this work? .center { margin: auto; text-align: center; } Edit Three Years Later :-D "margin: auto;"

How can I center something if I don't know ahead of time what the width is?

会有一股神秘感。 提交于 2019-11-30 22:46:35
I am trying to center a paragraph tag with some text in it within a div, but I can't seem to center it using margin: 0 auto without having to specify a fixed width for the paragraph. I don't want to specify a fixed width, because I will have dynamic text coming into the paragraph tag and it will always be a different width based on how much text it is. Does anyone know how I can center the paragraph tag within the div without having to specify a fixed width for the paragraph or without using tables? Here's how to do it using a style sheet. Style sheet: div.center-content { text-align: center;

Equivalent to <center> tag in CSS? [duplicate]

孤街浪徒 提交于 2019-11-30 22:32:27
问题 This question already has answers here : Why is the <center> tag deprecated in HTML? (18 answers) Closed 6 years ago . I read that the <center> tag is deprecated, however I cannot find any real equivalent to it in CSS. text-align works for text but not other elements, and auto margins only work if you know the width of the container (so not a solution if you don't know the width in advance). So is there any real equivalent to this <center> tag? 回答1: text-align should work for other kinds of