I have a problem with a certain tag, grabbed from an external source. This code you will see is taken from another website, and you could also see a date (ex. 15 Juli Måndag) There is dates all over the page, how could I center them with just CSS? Tried with absolute positioning, which leads to have all dates over each other.
Fiddle here.
My html:
<div id="header">
<div class="schema">
<h1>Schema</h1>
</div>
<div class="back"><a id="back" href="index.html"></a>
</div>
</div>
<div id="content">
<div class="content" style="margin-top:0px;">
<div class="article" style="text-align:center;">
<!-- Här skrivs det ut en massa saker -->
</div>
</div>
</div>
My JS:
$(window).load(function () { //Fade
$("#status").fadeOut();
$("#preloader").delay(350).fadeOut("slow");
})
grabShedule();
function grabShedule() {
var url = "http://1life.se/scraper/Schedule.php"; //URL
$.getJSON(url, function (response) {
var html = response.scraped[0].html; //Answer
$('.article').append(html); //Answer is appended to .article
});
}
Check out my fiddle, I don't know how to approach this problem...
How I want it:
To center an inline element like a link or a span or an img, all you need is text-align: center . For multiple inline elements, the process is similar. It's possible by using text-align: center .
The CSS just sizes the div, vertically center aligns the span by setting the div's line-height equal to its height, and makes the span an inline-block with vertical-align: middle. Then it sets the line-height back to normal for the span, so its contents will flow naturally inside the block.
Attribute Values Specifies the number of rows a cell should span. Note: rowspan="0" tells the browser to span the cell to the last row of the table section (thead, tbody, or tfoot).
If the span is dynamically generated inside the td
, I suggest you to make it as display:block;
and align it at the center with margin:0 auto;
For Instance,
td span{display:block; text-align:center; margin:0 auto;}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With