I seem to have troubles centring my div and center-block
doesn't seem to work.
I intend to center the nested div containing the <p>
tag. I am not so much trying to center the content inside the div. As such I would like have the center peroperty apply to the div itself rather than its contents.
<div class="container">
<div class="row">
<div class="col-xs-12 center-block">
<h1>{{secretDisplay.secretTitle}}</h1>
<div class="row center-block" style="text-align:left">
<div class="col-xs-12 center-block" style="text-align:left">
<p contenteditable="true" class="chat_window">
<img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/><img src="{% static 'img/Test1.jpg'%}" class="icon_one"/>
</p>
</div>
</div>
<div>
<p contenteditable="true" class="write_window">This is the test</p>
</div>
</div>
</div>
</div>
CSS
.center-block {
float: none;
display: block;
margin-left: auto;
margin-right: auto;
}
The page must be mobile responsive so Bootstrap's offset might cause issues.
Any advice would be highly appreciated.
Mike