I am used to designing Android layouts in XML and am wondering if there are parallels I can draw from this in my HTML design that I am currently working on. In particular, I have:
-------------------------------------------
| <img src="logo.png" |
-------------------------------------------
| n |
| a |
| v | Content
| b |
| a |
| r |
This is the template that I am working off of. In the original, the top bar is not an image logo, but a navbar-brand
and so everything seems to fit together quite well. I have replaced the "SB-Admin" up top with a logo (.png) which is notably bigger. The effect is that quite a bit of content as well as the "n" in the side navbar have been covered up.
What I am trying to figure out is how I can specify relative positioning,or how should I go about laying out this page so that everything is displayed? I am looking for something akin to navbar:layout_below=logo.png
type of thing in XML.
Currently my solution was to modify the .css associated with the navbar and the content and give them both a higher "margin-top", but this seems like a very hacky way to solve this problem. So my question is, is there a way to specify relative positioning within HTML, or am I supposed to trial and error with margins on my local machine, or else, what is the proper way to lay things out so that all content within the three Views shown in my example are displayed without overlapping each other?
<div id="wrapper">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="logo.png" class="navbar-brand">
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav"> <!-- This only looks ok if I change side-nav margin -->
<li class="active"><a href="index.html">Dashboard</a></li>
<li><a href="charts.html">Adoption</a></li>
<li><a href="tables.html">Usage Statistics</a></li>
<li><a href="forms.html">Classifiers</a></li>
</ul>
</div>
<div class="container">
<p>Hey</p> <!--this top here gets cut off-->
<p>Hey</p>
<p>What's up?</p>
<p>What's up?</p>
</div>
</div>
EDIT: Not necessarily relative layouts, I am looking for solutions that avoid hard-coding margin values, which is what I currently find myself doing, or if this is not bad practice I would also accept an answer that explains why not (i.e. would such a solution generalize to all screen sizes?).