css how to align absolute positioned child element to the right of fluid width parent
Tags: html,css,alignment,absolute,fluid-layout
Problem :
I'm trying to put some background images that are part of my layout to the left and the right of my main content div
.
This is the jsfiddle, as you can see giving the element a right margin of 0px doesn't affect the layout, giving it a left margin affects the layout, but since the width is variable I can't know the width of the wrapper div beforehand (without using Javascript which I don't want to).
css
#wrapper {
position: fixed;
width: 85%;
margin: 0 auto;
padding: 0px 30px 0px 30px;
overflow: auto;
background-color: grey;
}
#leftLayoutCol {
position: absolute;
height: 100%;
width: 30px;
margin-left: -30px;
background-color: green;
}
#rightLayoutCol {
position: absolute;
height: 100%;
width: 30px;
background-color: lightgreen;
margin-right: 0px;
}
#main {
padding: 0px 50px 0px 50px;
background-color: lightgrey;
}
html
<div id="wrapper">
<div id="leftLayoutCol">
</div>
<div id="rightLayoutCol">
</div>
<div id="main">
<h1>TEST</h1>
<h1>TEST</h1>
<h1>TEST</h1>
<h1>TEST</h1>
<h1>TEST</h1>
</div>
</div>
Any suggestions?
Thanks.
Solution :
Add the following attribute.
#rightLayoutCol {
right: 0;
}
Since #wrapper
is position: fixed
it already gives a new positioning context.
CSS Howto..
You have to implement two methods for hiding. display: none works for FF, but not Chrome or IE. So the second method is wrapping the <option> in a <span> with...
You can indeed use the pseudo-elements :after and :before to first mirror the image using transform: scaleY(-1); and second overlay the mirrored image with a linear gradient going from a...
Solved it by using "line-height" instead of "height": ng-style="{'line-height': '250px'}" Although this does not allow for wrapping longer text....
CSS only solution: http://jsfiddle.net/2YEzP/1/ I recommend you use another class/ID in front of the proposed selectors below, like this: .class123 table tr th:nth-child(1) or: table.class45 tr th:nth-child(1) Otherwise you could...
You cannot do that with pure/native CSS. So, I can see two workarounds for your problem: You can use the Less Framework Other way, you'll need to use Javascript to...
One of possible options is to use absolutely positioned generated content (:before for left "border", and :after for right one) with 100% height and CSS Gradients as background of generated...
What you need to do is load a css or json file by specifying the root. For example: Instead of using: <link rel="stylesheet" type="text/css" href="mystyle.css"> You should use: <link rel="stylesheet"...
I have modified your code abit. So basically what I did was to save the 'Correct' Answer into a variable. Then set this 'Answer' into 1 of the 9 boxes....
Ok, this was really stupid from me. I've written @import "normalize/normalize";, but after that I of course need to include it like @include normalize where 'normalize' is the mixin's name....
You need to add this to your css: @-webkit-keyframes fadeIn /* Safari and Chrome */ { 0% {opacity:0;} 100% {opacity:1;} } ...
You need the values pertaining to border thickness in your code: 0 100% 0 0/0 15px 0 0 stretch; The first four numbers are the activations of the gradient for...
use absolute positioning with %'s HTML: <div id="foo"></div> CSS: #foo{ position:absolute; top:10%; left:20%; } For the position you can use absolute, fixed, or relative depending on what suites best. Fixed:...
You can do like this @media print { body { font-size: 10pt; background-image: url(photo_with_white_background.jpg); } } To manipulate images you can use filters img {-webkit-filter: grayscale(100%); filter: grayscale(100%);} img {-webkit-filter:...
You need to add the following classes: li a { display:block; width:100%; } li a:hover { background-color: #0099FF; } and remove the property padding:10px; from the li.nav class. This will...
Well, I think the following CSS is your problem. I feel like you mighta been able to figure this out if you stuck with it for a bit. Just pull...
You're looking for the word-break property. You could use word-break: break-all: div { background-color: yellow; width: 100px; height: 100px; position: relative; word-break: break-all; } <div>veryveryveryveryveryveryveryveryveryveryveryverylongstring</div> ...
If you want to style tables in a generic manner, just change the CSS selectors accordingly. The <table> of <p:dataTable> is selectable by the ui-datatable class. .ui-datatable td { background:...
Check Opacity, You can set this css property to the div, the <p> or using <span> you want to make transparent And by the way, the font tag is deprecated,...
Live Demo I added this CSS: #results { position: relative } and changed your JavaScript like this: $("#tags").autocomplete({ source: availableTags, open: function(event, ui) { $('#results').css('top', $('.ui-autocomplete').height() + 8); }, close:...
You just need a helper to return the appropriate class: Template.YOURTEMPLATE.helpers({ headerClass: function () { var class = { 'ToDo': 'teal-header', 'Info': 'orange-header' }[this.type] return class || 'pink-header' } })...
The effect starts even when hovering div#right because it is a div#tracker child and the hover effect is bublling up to the parent. To achieve what you want only using...
The same restrictions don't occur on a desktop browser. This is specific to the implementation of scrolling that Apple has on their mobile device. It's a hold-over from their older...
I've had the same issue a while back. I've solved it by adding animation-fill-mode: forwards;. Usually, animation runs and stops, then goes back to the origional style. With animation-fill-mode you...
You need JavaScript. objDiv.scrollTop = objDiv.scrollHeight Unless the content is in an iframe. In which case you could make the url of the iframe "page.php#bottom" and add <div id="bottom"></div>...
Normally you would be correct, using font-size:80% will reverse font-size:125%. However the input tag does not default its font-size to inherit like most elements so they don't inherit them from...
JS Fiddle -> http://jsfiddle.net/ma3y77bt/ Here is the working HTML: <div class="main-content"> <div class="header">Header</div> <div class="body-content"></div> <div class="footer">Footer</div> </div> In order to have a fixed header and footer that span the...
Edit: I have created a fiddle with your pasted code. You didn't quite have the right syntax for the background image. http://jsfiddle.net/rnnj3ebc/ Try setting the image as the background image...
This might help you: http://basdebie.com/jquery-plugins/jquery-tags-autosuggest-like-delicious-stackoverflow-facebook/ By looking at this code, you should be able to create something similar, or just use the plugin....
You display:block along with float:left to float divs next to each other. Check working example at http://jsfiddle.net/FhL4u/2/ To make mainContent fill up rest of the space if only the first...
The only way to edit css file of a plugin is you need to have access to cpanel or ftp of that site. wp-content -> plugins -> open the specific...