I'm working in a web site, but it's the first time that a client ask me for ipad compatibility. So I started to work like usual but at the moment to see the result on the ipad there are some objects that i can't put in the correct position.
I already tried to change all my absolute positioning with margins and paddings, but this part(image above) does not work, when i change the position the content stay in the same place.
The current web site
The current css
But the important part is here:
<div id="super-wrapper">
<div id="wrapper">
<!-- Some Divs -->
<div id="content" class="open">
<!--This menu will be hidden -->
<ul id="navigation-fans">
<li id="registrate"><span>Registrate</span></li>
<li id="crea-club"><span>club</span></li>
<li id="conoce-clubs"><span>clubs</span></li>
</ul>
<div id="close-open" class="open"></div>
<div id="title"></div>
<div id="real-content"></div>
</div>
<!-- Some Divs -->
</div>
</div>
css
#wrapper{
width:1024px;
height:768px;
margin: 10px auto;
position:relative;
background: url(../../pics/1.jpg) no-repeat;
overflow:hidden;
}
#content{
background-image:url('../images/secciones_fondo.png');
height:423px;
width:1024px;
display:block;
position:relative;
right:-374px;
padding-top:1px;
margin-top:143px;
}
/* This is the position of #content when is open */
element.style {
right: -374px;
}
Update
I found that the problem is jplayer, but i still don't know wich is the real problem, by the moment i disable it and it works.
it might be your super-wrapper tag that you are not assigning correct properties to. If you look at the code, super-wrapper is essentially holding the same as wrapper, correct? If so, wrapper could be inheriting properties from super-wrapper which you might not be what you want.
Hope this helps.
Related
I generated a default template provided by dreamweaver for HTML5. Here it is http://jsfiddle.net/9XFEB/ . I wan to change the header and footer to full width. If i give auto property the footer disappears. Help me find out what I am missing.
<body>
<div class="container">
<header>
<img src="" alt="Insert Logo Here" width="180" height="90" id="Insert_logo" style="background-color: #C6D580; display:block;" />
</header>
<div class="sidebar1">
<ul class="nav">
<li>Link one</li>
<li>Link two</li>
<li>Link three</li>
<li>Link four</li>
</ul>
<aside>
<p> The above links demonstrate a basic navigational structure using an unordered list styled with CSS. Use this as a starting point and modify the properties to produce your own unique look. If you require flyout menus, create your own using a Spry menu, a menu widget from Adobe's Exchange or a variety of other javascript or CSS solutions.</p>
<p>If you would like the navigation along the top, simply move the ul to the top of the page and recreate the styling.</p>
</aside>
<!-- end .sidebar1 --></div>
<article class="content">
<h1>Instructions</h1>
<section>
<h2>How to use this document</h2>
<p>Be aware that the CSS for these layouts is heavily commented. If you do most of your work in Design view, have a peek at the code to get tips on working with the CSS for the fixed layouts. You can remove these comments before you launch your site. To learn more about the techniques used in these CSS Layouts, read this article at Adobe's Developer Center - http://www.adobe.com/go/adc_css_layouts.</p>
</section>
<section>
<h2>Clearing Method</h2>
<p>Because all the columns are floated, this layout uses a clear:both declaration in the footer rule. This clearing technique forces the .container to understand where the columns end in order to show any borders or background colors you place on the .container. If your design requires you to remove the footer from the .container, you'll need to use a different clearing method. The most reliable will be to add a <br class="clearfloat" /> or <div class="clearfloat"></div> after your final floated column (but before the .container closes). This will have the same clearing effect. </p>
</section>
<section>
<h2>Logo Replacement</h2>
<p>An image placeholder was used in this layout in the header where you'll likely want to place a logo. It is recommended that you remove the placeholder and replace it with your own linked logo. </p>
<p> Be aware that if you use the Property inspector to navigate to your logo image using the SRC field (instead of removing and replacing the placeholder), you should remove the inline background and display properties. These inline styles are only used to make the logo placeholder show up in browsers for demonstration purposes. </p>
<p>To remove the inline styles, make sure your CSS Styles panel is set to Current. Select the image, and in the Properties pane of the CSS Styles panel, right click and delete the display and background properties. (Of course, you can always go directly into the code and delete the inline styles from the image or placeholder there.)</p>
</section>
<!-- end .content --></article>
<aside>
<h4>Backgrounds</h4>
<p>By nature, the background color on any block element will only show for the length of the content. If you'd like a dividing line instead of a color, place a border on the side of the .content block (but only if it will always contain more content).</p>
</aside>
<footer>
<p>This footer contains the declaration position:relative; to give Internet Explorer 6 hasLayout for the footer and cause it to clear correctly. If you're not required to support IE6, you may remove it.</p>
<address>
Address Content
</address>
</footer>
<!-- end .container --></div>
</body>
You can simply add a css style for your header and footer like this:
header {
width:100%;
height:20%; //your desired height
position:absolute;
top:0;
left:0;
background-color:blue;
}
footer{
width:100%;
height:20%; //your desired height
position:absolute;
bottom:0;
left:0;
background-color:blue;
}
SEE THIS DEMO
Another way to do this is to separate the header, the footer, and the body into three different divs:
<html>
<head></head>
<body>
<div id="body">
<div id="header">your header content</div>
<div id="bodycontainer">your body content</div>
<div id="footer">your footer content</div>
</div>
</body>
</html>
To display the header and the footer using the full width of the page, use this CSS:
#body
{
width:100%;
height:100%; // the desired height
position:absolute;
top:0;
left:0;
}
#header
{
width:100%;
height:20%; // the desired height
position:absolute;
top:0;
left:0;
background-color:blue;
}
#footer
{
width:100%;
height:20%; // the desired height
position:absolute;
bottom:0;
left:0;
background-color:blue;
}
The header will be at the top of your page and the footer at its bottom. Both use the entire screen width.
Check this fiddle:
Simple Demo
Try giving footer and header outside the main div.Which is ur <div class="container">
Check this
http://jsfiddle.net/9XFEB/2/
Sorry, I couldn't post images without a higher reputation, so I linked them below:
PSD:
HTML:
Okay, the PSD screenshot is of what I want the alignment to do.
And the HTML screenshot is it's current form.
As you can tell, the sidebar is currently below the orange bar (nav) and the grey bar (banner). I know there is a way to make its position absolute and overlay it on top, but seeing that this is built on a responsive grid, I think that would ruin it.
Does anyone know of anyway to overlap the sidebar like it is shown in the psd without ruining the responsiveness?
I'm open to any and all suggestions.
Thanks!
Code:
<div class="container">
<div class="row">
<header> content </header>
</div>
</div>
<nav> content </nav>
<div class="container">
<div class="row">
<div class="col-sm-9">
<section>
<!-- Services Section Content -->
</section>
<services>
<!-- Clients Section Content -->
</section>
<section>
</div>
<div class="col-sm-3">
<!-- Sidebar -->
</div>
Using position:absolute would not ruin your responsive layout if you edit your media queries to compensate.
Alternately, try a negative margin on the sidebar element and set the z-index to be higher than the top bar element. Example:
header {
width:100%;
height:100px;
background:#ccc;
z-index:100;
}
.col-sm-9 {
width:200px;
height:500px;
margin:-50px 0 0 0;
background:#000;
z-index:200;
}
Have a fiddle: http://jsfiddle.net/68ANR/
It will perfectly works.Try it because position:absolute give the position to the main div or the parent div.
.col-sm-9 {
position:absolute;
left:/*give here from left*/px;
top:/*give here from top*/px;
width:200px;
height:500px;
background:#000;
z-index:200;
}
Hope the answer !
Please check out this website --> http://justicecup.radiantwebtools.com/
The section underneath the nav/logo/social-media area is further apart in Firefox as opposed to Chrome/Safari (the desired separation).
The issue seems to have to do with this part of the HTML:
<div class="header-container">...</div> <!--- Okay... --->
<div class="row content"> <!--- DevTools shows this the right underneath the header area...okay, thats correct --->
<div class="width-container">...</div> <!--- on Chrome/Safari it's good. On Firefox, this is pushed down further....why? --->
</div>
I have tried giving the header area some css to work against this, to no avail
.header-container { overflow:none;}
This screenshot shows the difference too --> http://screencast.com/t/CrF9HEaki
Thanks for your help.
I think the issue might have something to do with collapsing margins.
One fix for the issue, is to change the two rules below:
#template .content .story-primary {
margin-top: 28px;
}
#template .content .story {
margin-top: 62px;
}
to:
#template .content .story-primary {
padding-top: 28px;
}
#template .content .story {
padding-top: 62px;
}
Your page layout is quite complex and I think part of your problem stems from using .width-container in two unsuitable places. I've been fiddling with the css using the browser's inspect element, however when I change the styling in one it cascades to the other. I think a redesign of your page would be helpful. I would suggest enclosing the whole page content (excluding the background) in a div and applying the width-container styling to that.
<div id="body">
<div class="width-container">
<div id="templatewrapper"> ... </div>
<div id="templatefooter"> ... </div>
</div>
</div>
Next you should rename the width-container around the header stuff to something more appropriate.
<div id="page-header">
<div class="logo"> ... </div>
<div class="rwtmodule navigation-module meganav"> ... </div>
<div class="social-media"> ... </div>
</div>
After doing this you should replace the float:left; on the logo, navigation and social media to display:inline-block and get rid of the various margins. Then apply a padding or margin to the #page-header to push them down. The .logo and .social media will be in the wrong place but you can use position:relative and top:/*some value*/ to correct this.
After doing this, the site should look like the current firefox version in both firefox and chrome. You can then move the main body of the page up using relative positioning as you did with the logo and social media.
Remember to test this out in a safe location first!
Hope this helps.
I'm using bootstrap to do a simple version of something like this: http://techlist.in/
Basically, I want to have a map and a right side bar with a fixed size and fixed position.
I've started with something like:
HTML:
...
<div class="container">
<div class="span10">
<div id="map_canvas">
</div>
</div>
<div class="span2" style="position:fixed; right:0">
Some stuff
</div>
</div>
...
CSS:
#map_canvas {
display:block;
position:absolute;
height:auto;
bottom:0;
top:0;
left:0;
right:0;
margin-top:40px; /* used for the top navigation bar */
}
But this is not working as expected, as the map remains 100% width and the "some stuff" label appears on top of the map. Any hints?
UPDATE
In fact, I already have the nav-bar, but I did not detailed it in the code, my bad. So basically the whole structure of the html page is (with the missing row div added):
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
...
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span10">
<div id="map_canvas">
</div>
</div>
<div class="span2" style="position:fixed; right:0">
Some stuff
</div>
</div>
</div>
<!-- include javascript stuff -->
...
</body>
The css file is:
#map_canvas {
display:block;
position:absolute;
height:auto;
bottom:0;
top:0;
height: 90%
width: 80%;
left:0;
right:0;
margin-top:40px;
margin-right:200px;/* used for the top navigation bar */
background: #ccc;
}
If a leave 200px of right margin for the map, how can I fill the margin with the sidebar ?
Basically, I need a side bar of 200px width and the map adapting accordingly on screen resizing.
UPDATE 3
I'm wondering if I really need to use container / row to achieve this layout in fact (I still do not manage to have this working as expected). As I only need to have a map and a sidebar (that should always remain on the right of the map even if the window is resized), would it make some sense to use basic div / css and not bootstrap classes ?
This is basically what I needed: http://jsfiddle.net/kuXYq/4/
have a look at this fiddle I made it might help.
http://jsfiddle.net/eKQGD/
I used percentages to keep things the same
#map_canvas {
display:block;
position:absolute;
height:auto;
bottom:0;
top:0;
height: 90%
width: 80%;
left:0;
right:0;
margin-top:40px;
margin-right:150px;/* used for the top navigation bar */
background: #ccc;
}
There are a few parts to the answer to this question.
The first thing to point out is that it's a little hazy as to why there is the requirement of a "fixed size and position", and by that I mean that the terminology being used may be throwing off your thinking a bit. Typically, you only need to use the "fixed" css position property if you plan on the page having scroll bars and you want the element to stay in the same position on the page no matter what. In this case, it doesn't seem like you want page scrolling at all since the map will appear to be the same size as the entire page. It seems like what you really want on the sidebar is for it to be a fixed height (aka the height of the browser window) with overflow set to scroll.
Secondly, it appears that you're missing a <div class="row"></div> tag around your elements - a tag with a "row" class is necessary to make the bootstrap "span" classes work.
Lastly, here is something that I would go with if I was trying to duplicate the link you posted, using a bit of JS love as well: http://jsfiddle.net/kzBkA/5/ (background colors added just to show what it looks like )
HTML:
<div class="container">
<div class="row">
<div class="span10">
<div id="nav_bar">
Nav bar goes here
</div>
<div id="map_canvas">
test
</div>
</div>
<div class="span2">
<div id="sidebar">
Some stuff
</div>
</div>
</div>
</div>
css:
#nav_bar {
height:40px;
background-color:blue;
}
#map_canvas {
background-color:green;
}
#sidebar{
background-color:red;
overflow-y:auto;
}
js:
$(function(){
$("#map_canvas").height($(window).height() - 40);
$("#sidebar").height($(window).height());
});
UPDATE:
So - again, first off, I encourage you to reconsider your use of fixed elements. You seem to be trying to build a page that won't scroll, but then using a "positioning" feature that's specifically for scrolling (position:fixed), which basically tells all your nice bootstrap code to be ignored and just put it where you tell it. A much nicer way to do this would be to use Bootstrap to your advantage. I changed the row class to row-fluid, I moved your nav bar into the span10 with the map (since that's how wide you actually want the nav, or at least that's how it was in the example), I removed the "navbar-fixed-top" class since you don't actually need things to be fixed, and removed the fixed positioning from the sidebar (since again that's basically making it ignore what you're trying to do). Check out the updated jsfiddle: http://jsfiddle.net/kzBkA/7/ - you may have to tinker with the JS to get the map_canvas div set with the correct height, but otherwise this should take care of making your page fluid when the browser is resized without having to add a ton of unnecessary CSS rules. In general, if you use a scaffolding framework, you should use it to your advantage to avoid creating cluttered, messy css with lots of "width:80%; height:20%; margin: ..." - the whole point of using the framework and scaffolding was to avoid that kind of code :)
HTML:
<div class="container">
<div class="row-fluid">
<div class="span10">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
navbar
</div>
</div>
<div id="map_canvas">
map goes here
</div>
</div>
<div class="span2" id="sidebar">
Some stuff
</div>
</div>
</div>
CSS:
.container{
max-width:100%;
}
#map_canvas {
background-color:green;
}
#sidebar{
background-color:red;
overflow-y:auto;
}
JS:
$(function(){
$("#map_canvas").height($(window).height() - 40);
$("#sidebar").height($(window).height());
});
UPDATE 2
Just realized I missed the part about the sidebar always being 200px but the map width being fluid. I've updated the fiddle to reflect that as well as updating so that sizes get reset when window is resized - http://jsfiddle.net/kzBkA/9/
HTML:
<div class="container">
<div class="row-fluid">
<div class="span10 left-col">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
navbar
</div>
</div>
<div id="map_canvas">
map goes here
</div>
</div>
<div class="span2 right-col" id="sidebar">
Some stuff
</div>
</div>
</div>
CSS:
.container{
max-width:100%;
}
#map_canvas {
background-color:green;
}
#sidebar{
background-color:red;
overflow-y:auto;
}
.right-col{
width:200px;
}
JS:
$(function(){
resizeElements();
window.onresize = function(event) {
resizeElements();
}
});
function resizeElements(){
//set height
$("#map_canvas").height($(document).height() - $(".navbar").outerHeight() - 20 /*not sure where this is coming from, possibly the scrollbar?*/);
$("#sidebar").height($(document).height());
//set width of left col
$(".left-col").width($(document).width() - $(".right-col").outerWidth() - 20 /*not sure where this is coming from, possibly the scrollbar?*/)
}
I have two divs, the one acts as a panel, the second is a mapview (openlayers)
The panel is hidden at the start, and only shows up on a click. however, when the panel appears, the mapdiv gets pushed to the right and overlaps with another div. how can I prevent that?
What I basically want is that the panel appears on top of the map.
This is my code:
<!-- TOOLBAR/PANEL -->
<div class="waveCreatorPanel" style="visibility:hidden; display:none;">
<ul>
<li><a id="createWave_addStation"data-role="button">Station hinzufügen</a></li>
<li><a id="createWave_addItem" data-role="button" disabled="disabled">Item hinzufügen</a></li>
<li><a id="createWave_saveWave"data-role="button">Wave speichern</a></li>
</ul>
</div><!-- /footer -->
<!-- MAP -->
<div class="geosurfmap" id="map" data-role="content" style="z-index:1"></div>
The CSS:
.waveCreatorPanel {
float:left;
}
.geosurfmap {
padding:25px;
margin:25px;
width:80%;
float:left;
}
absolute positioning for one or both of these will definetly solve this
<div class="panel" style="visibility:hidden; display:none; position:absolute; left:0px; top:0px;">
<ul>
//stuff here
</ul>
</div>
<!-- MAP -->
<div class="map" id="map" data-role="content" style="position:absolute; left:100px; top:100px;"></div>
styling could be applied with css stylesheet attached , or inline - since you already have a style attribute in your div's I just added an example of how to set absolute - adjust left and top to where you actually want them
When you originally had visibility:hidden; display:none; that is leaving the other div to be positioned relative , with nothing around it. It is the same as actually not having it in HTML at all , then when it changes to become visible everything that was positioned relative has to be adjusted , absolute positioning will fix this
Another Thing: you're title says "Parent Div" - this in NOT a parent div of the div that is getting shifted around , it is actually adjacent. You would not be having this problem if it was actually a parent. But then again the parent starts as hidden , so everything in it would be hidden
Some possible solutions depending on the rest of your page:
position:absolute
z-index
You could wrap the map and panel divs in another div and give that the minimum required width (were the panel div to be visible). Secondly you would float the map div right
<div id="wrapper">
<div class="panel"></div>
<div class="map"</div>
</div>
<style>
#wrapper {
min-width: 500px;
}
#wrapper .panel {
position:relative;
float: left
}
#wrapper .map {
position: relative;
float:right;
}
</style>
EDIT
To clarify my point I have made a fiddle for you
You can set the panel class to display:none or block to see that the map div now does not displace anymore as a result