automatic width of a div inside a div container - html

I have a design question.
I need to create a progress bar for a video player.
I have a div container (id videoManager) with all the div about the PLAY, the STOP, the progress bar, the VOLUME, other buttons, all one beside the other (floating left).
i would like the div of the progress bar (id playerSlider) resizes depending on the remained space. i wrote down this code, but if use "width: 100%;" for this div, it doesn't get the remained space, but the 100% of the container.
suggestions?
HTML:
<div id="videoManager">
<div id="playpauseCommand">Play</div>
<div id="stopCommand">Stop</div>
<div id="playerSlider">
<div id="objSlider"></div>
</div>
<div id="timeElement">10:12:12</div>
<div id="volumeSlider"></div>
<div id="displayCommand">Command</div>
</div>
CSS:
div#videoManager{
margin-top: 30px;
width: 980px;
height: 44px;
background: transparent url('bg.jpg') center center repeat-x;
position: relative;
color: #fff;
}
div#playpauseCommand, div#stopCommand{
width: 44px;
height: 44px;
float: left;
border-right: 2px solid #555;
}
div#playerSlider{
float:left;
height: 44px;
width: 100%;
padding: 15px 10px 0px 10px;
}
div#objectSlider{
float: left;
clear: left;
width: 100%;
}
div#timeElement{
float: left;
height: 44px;
width: 80px;
border-right: 2px solid #555;
}
div#volumeSlider{
float: left;
height: 44px;
width: 180px;
border-right: 2px solid #555;
}
div#displayCommand{
float: left;
height: 44px;
width: 70px;
border-right: 2px solid #555;
}
and this is a link to my site.

try this css code, not sure if this is exactly what you want though:
div#videoManager{
margin-top: 30px;
width: 980px;
height: 44px;
background: transparent url('bg.jpg') center center repeat-x;
position: relative;
color: #fff;
}
div#playpauseCommand, div#stopCommand{
width: 44px;
height: 44px;
float: left;
border-right: 2px solid #555;
}
div#playerSlider{
float:left;
height: 44px;
width: 53%;
padding: 15px 10px 0px 10px;
position:absolute;
left:178px;
}
div#objectSlider{
float: left;
clear: left;
width: 100%;
}
div#timeElement{
float: left;
height: 44px;
width: 80px;
border-right: 2px solid #555;
}
div#volumeSlider{
float: right;
height: 44px;
width: 180px;
border-right: 2px solid #555;
}
div#displayCommand{
float: right;
height: 34px;
width: 70px;
top:10px;
border-right: 2px solid #555;
position:relative;
}

Related

Individual Background Images for Individual Divs

For a current project of mine, I'm working on a website for a clan of sorts. They've asked me to create a grid of games that they play, and I seem to be struggling with that.
Each individual div considsts of a background-image and a p element for the title of the game. Currently, for every different game, I have to create a new div and a new class in my style sheet, and I only end up changing the left-margin a bit and changing that background image's filepath. It feels like a bit of a waste of time to me.
The code is as follows:
(HTML)
<div id="content" align="center">
<div class="content-box">
<div class="content-box-game-one">
<p>Just Cause 2</p>
</div>
<div class="content-box-game-two">
<p>War Thunder</p>
</div>
<div class="content-box-game-three">
<p>Borderlands 2</p>
</div>
<br />
<div class="content-box-game-four">
<p>Heroes and Generals</p>
</div>
<div class="content-box-game-five">
<p>Grand Theft Auto V</p>
</div>
<div class="content-box-game-six">
<p>Dirty Bomb</p>
</div>
<br />
<div class="content-box-game-seven">
<p>PayDay 2</p>
</div>
<div class="content-box-game-eight">
<p>Team Fortress 2</p>
</div>
<div class="content-box-game-nine">
<p>Coming soon...</p>
</div>
</div>
(CSS)
#content {
margin-top: 3px;
}
.content-box {
width: 1150px;
height: 100%;
}
.content-box-game-one {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 80px;
background-image: url('http://i.imgur.com/ZZtELB6.png');
background-size: 400px;
}
.content-box-game-two {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 20px;
background-image: url('http://war-thunder-hack.marioapps.net/assets/cheatmp/images/background.jpg');
background-size: 400px;
}
.content-box-game-three {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 20px;
background-image: url('http://www.hardcoregamer.com/wp-content/uploads/2012/10/borderlands2.jpg');
background-size: 400px;
}
.content-box-game-four {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 80px;
background-image: url('http://www.gamewallpapers.com/previews_480x300/wallpaper_heroes_and_generals_01.jpg');
background-size: 400px;
}
.content-box-game-five {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 20px;
background-image: url('http://static.guim.co.uk/sys-images/Guardian/Pix/audio/video/2012/11/15/1352984366518/Grand-Theft-Auto-V-005.jpg');
background-size: 400px;
}
.content-box-game-six {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 20px;
background-image: url('https://metrouk2.files.wordpress.com/2012/11/article-1354195970386-16454a86000005dc-11033_636x353.jpg');
background-size: 400px;
}
.content-box-game-seven {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 80px;
background-image: url('http://www.gamechup.com/wp-content/uploads/2013/08/payday-2-featured-1.jpg');
background-size: 400px;
}
.content-box-game-eight {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 20px;
background-image: url('https://upload.wikimedia.org/wikipedia/en/5/59/TF2_Group.jpg');
background-size: 400px;
}
.content-box-game-nine {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 20px;
background-image: url('http://www.exoticindia.com/religious/sfa47.jpg');
background-size: 400px;
}
.content-box p {
margin-top: 80px;
font-family: Lobster;
font-weight: bold;
font-size: 30px;
color: white;
}
Is there anyway I can just create one class on my stylesheet and have it so that the background image will change? Any other ways around this problem?
Thanks!
Since all other properties are same other than background-image you can create one general class like:
.content-box-game {
border: 3px solid black;
border-radius: 5px;
margin-top: 20px;
width: 300px;
height: 200px;
float: left;
margin-left: 80px;
background-size: 400px;
}
Then you only need to specify a background-image property in your other classes.
.content-box-game-one{
background-image: url('http://www.hardcoregamer.com/wp-content/uploads/2012/10/borderlands2.jpg');
}
Add both classes to your div
<div class="content-box-game content-box-game-one">
<p>Borderlands 2</p>
</div>

Html5/CSS3 resize layout can't work fine

When I adjust the width of the window
I want to A B C Block sequentially arranged vertically down,
I tried for a long time, may I ask how to solve, thank you help
like below ....
A
B
C
div#menu {
border: 1px solid red;
padding: 7px 7px 7px 7px;
}
div#navigation {
border: 1px solid black;
background: #A9F5A9;
height: 495px;
margin: 2px 2px 2px 2px;
float: left;
text-align: center;
line-height: 250px;
font-size: 100px;
width: 31%;
}
div#content {
height: 495px;
border: 1px solid black;
background: #F2F5A9;
margin: 2px 2px 2px 2px;
width: auto;
text-align: center;
line-height: 500px;
font-size: 100px;
margin-right: 33%;
}
#wrapper {
float: right;
width: 100%;
margin-right: -33%;
}
div#footer {
border: 1px solid black;
background: #81F7F3;
color: #000;
height: 50px;
margin: 1px 1px 1px 1px;
text-align: center;
line-height: 50px;
font-size: 50px;
clear: both;
width: auto;
}
<div id="menu">
<div id="container">
<div id="wrapper">
<div id="content">A</div>
</div>
<div id="navigation">B</div>
<div id="footer">C</div>
</div>
</div>
i think you can try this one
div#menu {
display: table-row;
}

I am using a 2 column template in Expression Web 4 - How do I keep sidebar equal sizes?

I attempted the solution that another person listed, and it kind of equaled it out, but because the content section grows depending on what I put in it, it looks goofy with the side bar staying the smaller size.
I am open to ideas, but I would rather have the column move with the content, such as floating up and down, or... At least show the same size...
The following is what I have in CSS now:
#import url("layout.css");
body {
font-family:"Georgia", "Times New Roman", Times, serif;
font-size: 0.8em;
background-color: #764;
background-image: url("../images/background.gif");
background-repeat: repeat;
background-attachment: scroll;
}
#container {
width: 700px;
margin: 10px auto;
}
#masthead {
text-align: center;
width: 698px;
border: 1px solid #431;
background-color: #fff;
background-image:;
background-attachment: scroll;
}
#navigation {
position: absolute;
float: left;
width: 148px;
height: 100%;
margin-top: 10px;
margin-bottom: 10px;
border: 1px solid #431;
background-color: #fff;
}
#content {
overflow: hidden;
float: right;
width: 518px;
margin:auto;
margin-top: 10px;
margin-bottom: 10px;
margin-left: 10px;
padding: 10px;
border: 1px solid #431;
background-color: #fff;
}
#footer {
text-align: center;
clear: both;
width: 698px;
padding: 0px;
border: 1px solid #431;
background-color: #fff;
}
The webpage can be seen at http://www.crucifiedwithchrist.org.
Thanks,
John
define height
#navigation {
position: relative;
float: left;
width: 148px;
margin-top: 10px;
margin-bottom: 10px;
border: 1px solid #431;
background-color: #fff;
height: 730px;
}

CSS Container fit to Child-Images

First: I really tried to find an answer but non of them worked for me.
Here's my problem:
I have a base layout where I have a forward and a backward button in the footer.
Theses buttons must be quadratic. So I've decided to make them simple images (to avoid all the problems with trying to scaling divs propotionally).
Theses images have CSS:
.galleryFooterController {
position: relative;
height: 100%;
float: left;
margin-left: 5px;
background-color: #A0A0A0;
}
And are nested in a container with CSS:
#galleryFooterControlle {
position: absolute;
display: inline-block;
right: 15%;
background: white;
height: 100%;
padding-right: 5px;
width: auto;
}
But the container is not taking the correct width so that the images are not fitting inside and are rendered under each other. If I take out the height: 100% from the images, they fit next to each other in the container.
It would be great if you could help me finding a JS-free version to solve this problem!
Thanks!
Here is a FIDDLE that will give you a start.
I haven't made all of the divs line-up, but you can change the CSS to make it look prettier.
For your buttons, I just used div in a div with CSS-Tricks triangle - You can use .click on the outer div to run your function.
Here's the relevant CSS
.header {
width: 100%;
height: 50px;
background-color: #A0A0A0;
border: 4px solid white;
}
.container {
width: 90%;
height: 400px;
background-color: #A0A0A0;
border: 4px solid white;
float: left;
}
.rightbar {
width: 9%;
height: 460px;
border: 1px solid white;
float: right;
background-color: #A0A0A0;
}
.bottomholder {
width: 90%;
height: 50px;
border: 1px solid black;
}
.bottomleft {
height: 100%;
width: 562px;
float: left;
background-color: #A0A0A0;
border-left: 2px solid white;
}
.bottombutton {
height: 100%;
width: 130px;
float: left;
background-color: #A0A0A0;
border-left: 2px solid white;
}
.bottomright {
height: 100%;
width: 200px;
float: left;
background-color: #A0A0A0;
border-left: 2px solid white;
}
.arrowleft {
width: 40px;
height: 40px;
border-radius: 50%;
border: 4px solid white;
background-color: #A0A0A0;
float: left;
margin-left: 10px;
}
.arrow-left {
width: 0;
height: 0;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
border-right: 15px solid black;
margin-left: 8px;
margin-top: 5px;
}
.arrowright {
width: 40px;
height: 40px;
border-radius: 50%;
border: 4px solid white;
background-color: #A0A0A0;
float: left;
margin-left: 10px;
}
.arrow-right {
width: 0;
height: 0;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
border-left: 15px solid black;
margin-left: 15px;
margin-top: 5px;
}
Just i tried with liquid layout, removed the border 2px white and change the float property.
.header {
width: 98%;
height: 50px;
background-color: #A0A0A0;
margin:2px 2px;
}
.container{
width: 85%;
height: 400px;
background-color: #A0A0A0;
margin:2px 2px;
float: left;
}
.rightbar{
width: 12%;
height: 460px;
float: left;
background-color: #A0A0A0;
margin-top:2px;
margin-left: 2px;
padding-left: 3px;
}
Full Code http://jsfiddle.net/judearasu/5c5rq/
Thanks to everyone I figguered out how to solve the problem!
Because the images coudn't be rendered next to each other because its container would't pick the right width after scaling the images, i simply made the container width to the maximum available place which was in my project 85%. So now the images are fitting in!
Thanks again!

CSS split bar graph with solid border radius

I'm trying to let a div container with a black background substitute as the border style for a bar graph that has a border radius. Here's the HTML/CSS:
HTML:
<div class="graph-outer">
<div class="inner-left-cap"></div>
<div class="inner-left-bar">40%</div>
<div class="inner-right-bar">60%</div>
<div class="inner-right-cap"></div>
</div>
CSS:
.graph-outer {
background-color: black;
height: 20px;
width: 300px;
border-radius: 10px;
padding: 1px;
}
.inner-left-cap {
background: orange;
width: 2%;
height: 100%;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
float: left;
}
.inner-left-bar {
background: orange;
width: 38%;
height: 100%;
text-align: center;
float: left;
}
.inner-right-cap {
background: red;
width: 2%;
height: 100%;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
float: left;
}
.inner-right-bar {
background: red;
width: 58%;
height: 100%;
text-align: center;
float: left;
}
http://jsfiddle.net/2ZkDz/115/
The issue in which I am having is that the corners don't look as if they have any black border style whatsoever. What can I do?
Use this version with overflow:hidden and a explicit border on your outer controller and no padding.
.graph-outer {
background-color: black;
height: 20px;
width: 300px;
border:1px solid black;
border-radius: 10px;
overflow:hidden;
}
.inner-left-cap {
background: orange;
width: 2%;
height: 100%;
float: left;
}
.inner-left-bar {
background: orange;
width: 38%;
height: 100%;
text-align: center;
float: left;
}
.inner-right-cap {
background: red;
width: 2%;
height: 100%;
float: left;
}
.inner-right-bar {
background: red;
width: 58%;
height: 100%;
text-align: center;
float: left;
}
​
http://jsfiddle.net/2ZkDz/116/
I've updated your CSS, I changed the caps to 3% each and made the bars smaller. The bar on the inside was going over the caps.
.graph-outer {
background-color: black;
height: 20px;
width: 300px;
border-radius: 10px;
padding: 1px;
}
.inner-left-cap {
background: orange;
width: 3%;
height: 100%;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
float: left;
}
.inner-left-bar {
background: orange;
width: 37%;
height: 100%;
text-align: center;
float: left;
}
.inner-right-cap {
background: red;
width: 3%;
height: 100%;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
float: left;
}
.inner-right-bar {
background: red;
width: 57%;
height: 100%;
text-align: center;
float: left;
}
​
http://jsfiddle.net/2ZkDz/119/
http://jsfiddle.net/2ZkDz/120/
border-radius: 10px;
padding: 2px;
That should do it! I just threw on a border-radius and bumped up the padding 1. There should be an easier way using the actual border property but im feeling lazy and this does it
a solution without the end-caps (that way the bar width matches the values)
demo jsfiddle
the graph-outer is 20px tall so the nested bars are 18px (20px - 2px (1px top/bottom padding)), set the border-radius on the bars to 9px each (half of the height so each corner is uniform and matches the parents curvature)
.inner-left-bar {
background: orange;
width: 40%;
height: 100%;
text-align: center;
float: left;
border-radius:9px 0 0 9px; /* add this */
}
.inner-right-bar {
background: red;
width: 60%;
height: 100%;
text-align: center;
float: left;
border-radius:0 9px 9px 0; /* and this */
}
/* and drop the end-caps */
​