I'm trying to adjust the div containers on my page to fit into the browser window when the browser resizes. I need help with this.
I use the class col-md-2 from bootstrap. There are several other classes in use.
What i want is that the div containers keep maintaining the position inside the whole window.
#font-face {
font-family: Blanch-Condensed;
src: url(BLANCH_CONDENSED.otf);
}
#fully {
right: 14px;
position: relative;
padding-right: 23px;
}
#img1 {
width: 530px;
height: 339px;
padding-left: 49px;
}
#rsoftbackground {
background-color: #D2E3CF;
width: auto;
height: auto;
margin-left: auto;
margin-right: auto;
}
#content2 {
background-color: #EBC083;
width: auto;
height: auto;
}
#menubar {
background-color: #428cba;
font-family: "Oswald";
}
#t2 {
font-family: "Blanch-Condensed";
color: #0840B1;
font-size: 64px;
left: 195px;
position: relative;
background-color: #D2E3CF;
}
#t3 {
font-family: "Blanch-Condensed";
color: #0840B1;
font-size: 22px;
left: 195px;
position: relative;
background-color: #D2E3CF;
}
.opcion1 {
line-height: 35px;
color: white;
font-family: "Blanch-Condensed";
font-weight: bold;
font-size: 20px;
}
.opcion2 {
line-height: 35px;
color: white;
font-family: "Blanch-Condensed";
font-weight: bold;
font-size: 20px;
}
.opcion3 {
line-height: 35px;
color: white;
font-family: "Blanch-Condensed";
font-weight: bold;
font-size: 20px;
}
.opcion4 {
line-height: 35px;
color: white;
font-family: "Blanch-Condensed";
font-weight: bold;
font-size: 20px;
}
.opcion5 {
line-height: 35px;
color: white;
font-family: "Blanch-Condensed";
font-weight: bold;
font-size: 20px;
}
#interiormenu {
width: 150px;
height: 170px;
background-color: #428cba;
position: relative;
top: 0px;
padding-top: 58px;
border-color: #737373;
border-style: solid;
border-width: 3px;
left: 409px;
}
#interiormenu2 {
width: 150px;
height: 170px;
background-color: #428cba;
position: relative;
top: 0px;
padding-top: 58px;
border-color: #737373;
border-style: solid;
border-width: 3px;
left: 409px;
}
#interiormenu3 {
width: 150px;
height: 170px;
background-color: #428cba;
position: relative;
top: 0px;
padding-top: 58px;
border-color: #737373;
border-style: solid;
border-width: 3px;
left: 409px;
}
#interiormenu4 {
width: 150px;
height: 170px;
background-color: #428cba;
position: relative;
top: 0px;
padding-top: 58px;
border-color: #737373;
border-style: solid;
border-width: 3px;
left: 409px;
}
#interiormenu5 {
width: 150px;
height: 170px;
background-color: #428cba;
position: relative;
top: 0px;
padding-top: 58px;
border-color: #737373;
border-style: solid;
border-width: 3px;
left: 409px;
}
.BlueClass {
color: white;
font-family: "Oswald";
font-weight: bold;
width: 150px;
height: 170px;
background-color: #8933B4;
position: relative;
top: 0px;
border-color: #FFFFFF;
border-style: solid;
border-width: 3px;
margin-left: -17px;
margin-top: -60px;
padding-top: 58px;
}
<div class="continer-fluid">
<div class="row" id="fully">
<div class="col-md-2" id="rsoftbackground">
<h1 id="t2">RSOFT S.A</h1>
<h2 id="t3"> Construimos tecnologia para el futuro</h2>
</div>
<div class="row" id="rsoftbackground">
<div class="col-md-2" id="interiormenu">
<div class="text-center">
<div class="sonido1">
<audio src="sonido/switch-flick.wav" preload="auto"></audio>
Quienes Somos
</div>
</div>
</div>
<div class="col-md-2" id="interiormenu2">
<div class="text-center">
<div class="sonido1">
<audio src="sonido/switch-flick.wav" preload="auto"></audio>
Clientes
</div>
</div>
</div>
<div class="col-md-2" id="interiormenu3">
<div class="text-center">
<div class="sonido1">
<audio src="sonido/switch-flick.wav" preload="auto"></audio>
Portafolio
</div>
</div>
</div>
<div class="col-md-2" id="interiormenu4">
<div class="text-center">
<div class="sonido1">
Servicios
</div>
</div>
</div>
<div class="col-md-2" id="interiormenu5">
<div class="text-center">
<div class="sonido1">
Intranet
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" id="content2">
<img src="fotos/shutterstock_189855374 (1).png" width="530" height="339" id="img1">
</div>
<div class="col-md-12" id="content2">
<p> CREAMOS LO MEJOR PARA TI</p>
</div>
</div>
</div>
In order to do this you might need to use Java Script:
var div = document.getElementsByTagName("div");
for (var i in div){
div[i].width = window.innerWidth;
div[i].height = window.innerHeight;
}
Related
I have a navigation menu that's fixed in the left inside a div.
I want to be able to put a logo right next to it, centered, but to the right of the menu.
I'm not able to realise what I have to do in the code in order to get it
I tried using a div inside the div, but that does not do it
* {
background-color: black
}
* {
padding: 0;
margin: 0;
}
.navigation {
z-index: 1;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size: 20px;
font-weight: bold;
border-style: dashed;
border-color: green;
border-radius: 20px;
height: 80px;
width: 750px;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 10px 12px;
text-decoration: none;
border-style: dotted;
margin-left: 24px;
margin-top: 11px;
}
li a:hover {
background-color: red;
}
.parrafo {
font-size: 40px;
padding: 75px;
border-radius: 10px;
margin-top: 10px;
margin-bottom: 10px;
border-left: 22px;
padding-left: 150px;
border-top: dotted 5px red;
border-bottom: dotted 5px yellowgreen;
display: flex;
flex-direction: row;
font-family: sans-serif;
font-weight: bold;
color: white;
}
.queonda {
font-family: sans-serif;
font-weight: bold;
color: white;
font-size: 50px;
margin-left: 85px;
}
.test {
margin-left: 200px;
margin-top: 270px;
}
.test2 {
margin-top: 100px;
margin-bottom: 100px;
margin-left: 750px;
}
.portrait {
overflow: hidden;
display: inline-block;
}
.portrait img {
transition: transform 0.5s linear;
background-image: cover;
}
.portrait:hover img {
transform: scale(1.1);
}
.cat {
height: 1250px;
width: 1900px;
}
.algo {
height: 100vh;
width: 100vw;
}
.active {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.ptm {
font-size: 70px;
color: white;
position: right;
margin-right: 500px;
display: inline;
}
<div class="navigation active">
<ul>
<li>Tour</li>
<li>Listen to Music</li>
<li>Contact</li>
<li>About</li>
</ul>
</div>
<div class="portrait algo"><img src="https://i.ibb.co/dLrSmP7/1111.jpg" alt=""></div>
<div class="parrafo">
<img src="https://muzikercdn.com/uploads/products/4207/420772/09821a89.jpg" alt="Ciudad con Transito">
<P class="test">MUSIC<br>MAINSTREAM SELLOUT</P>
</div>
<div class="test2">
<P class="queonda">VIDEOS</P><br><br>
<video width="1280" controls autoplay="off">
<source src="./img/prueba2.mp4" type="video/mp4">
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col">
<h4>Terms & Conditions</h4>
</div>
<div class="footer-col">
<h4><a class="textDecoration" href="#privacy">Privacy and Policy</a></h4>
</div>
<div class="footer-col">
<h4>Follow Us</h4>
<div class="social-links">
</div>
</div>
<div class="footer-col">
<div class="social-links">
<h3>
</h3>
</div>
</div>
</div>
</footer>
I would really appreciate your help with this
If you want it in the menu but next to it, you should just add the logo as a list item. Then you can give it a class (I called it logo) to reposition it.
See below:
* {
background-color: black
}
* {
padding: 0;
margin: 0;
}
.navigation {
z-index: 1;
}
.logo {
padding: 6px;
border: 0;
margin-left: 4em;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size: 20px;
font-weight: bold;
border-style: dashed;
border-color: green;
border-radius: 20px;
height: 80px;
width: 750px;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 10px 12px;
text-decoration: none;
border-style: dotted;
margin-left: 24px;
margin-top: 11px;
}
li a:hover {
background-color: red;
}
.parrafo {
font-size: 40px;
padding: 75px;
border-radius: 10px;
margin-top: 10px;
margin-bottom: 10px;
border-left: 22px;
padding-left: 150px;
border-top: dotted 5px red;
border-bottom: dotted 5px yellowgreen;
display: flex;
flex-direction: row;
font-family: sans-serif;
font-weight: bold;
color: white;
}
.queonda {
font-family: sans-serif;
font-weight: bold;
color: white;
font-size: 50px;
margin-left: 85px;
}
.test {
margin-left: 200px;
margin-top: 270px;
}
.test2 {
margin-top: 100px;
margin-bottom: 100px;
margin-left: 750px;
}
.portrait {
overflow: hidden;
display: inline-block;
}
.portrait img {
transition: transform 0.5s linear;
background-image: cover;
}
.portrait:hover img {
transform: scale(1.1);
}
.cat {
height: 1250px;
width: 1900px;
}
.algo {
height: 100vh;
width: 100vw;
}
.active {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.ptm {
font-size: 70px;
color: white;
position: right;
margin-right: 500px;
display: inline;
}
<div class="navigation active">
<ul>
<li>Tour</li>
<li>Listen to Music</li>
<li>Contact</li>
<li>About</li>
<li>
<a class="logo"><img src="https://dummyimage.com/40/#41404/fff"></a>
</li>
</ul>
</div>
<div class="portrait algo"><img src="https://i.ibb.co/dLrSmP7/1111.jpg" alt=""></div>
<div class="parrafo">
<img src="https://muzikercdn.com/uploads/products/4207/420772/09821a89.jpg" alt="Ciudad con Transito">
<P class="test">MUSIC<br>MAINSTREAM SELLOUT</P>
</div>
<div class="test2">
<P class="queonda">VIDEOS</P><br><br>
<video width="1280" controls autoplay="off">
<source src="./img/prueba2.mp4" type="video/mp4"></video>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col">
<h4>Terms & Conditions</h4>
</div>
<div class="footer-col">
<h4><a class="textDecoration" href="#privacy">Privacy and Policy</a></h4>
</div>
<div class="footer-col">
<h4>Follow Us</h4>
<div class="social-links">
</div>
</div>
<div class="footer-col">
<div class="social-links">
<h3>
</h3>
</div>
</div>
</div>
</div>
</footer>
Side note: forgot to close </video> and the .container div which was making your HTML invalid.
I have a simple page, background image and a text box.
I need the text box to be at the front but as I'm quite new to html/css I just got lost a bit :)
I tried to solve it with z-index but also didn't find the right way to do it.
This is the html:
<div><img src="back.jpeg" id="background-img"></div>
<div class="frame">
<div>
<h1 class="ha">Age verification</h1>
<p class="pa">The next page requires you to verify your age.</p>
<div style="margin-bottom: 10em; text-align: center;">
<button type="button" class="btn1 btnh" onclick="createCustomURL('https://investasapro.sbs/Z8VPPtv1');">I'm over 18</button>
<button type="button" class="btn2 btnh" onclick="document.location='../underage'">I'm under 18</button>
</div>
</div>
</div>
This is the css:
<style>
.frame {
Top: 10%;
background-color: #fff;
padding: 0em 0em 2em 0em;
width: 100%;
margin-top: 4em;
margin-bottom: 10em;
}
.ha {
text-align: center;
padding: 1em 0em;
font-size: 40px;
}
.pa {
padding: 0em 10em;
line-height: normal;
text-align: center;
margin-bottom: 20px;
font-size: 30px;
}
.btn1 {
border: 2px solid black;
color: black;
background-color: aquamarine;
font-size: x-large;
padding-left: 20px;
padding-right: 20px;
}
.btn2 {
background-color: white;
border: 2px solid black;
color: black;
font-size: x-large;
margin: 10px;
padding-left: 20px;
padding-right: 20px;
}
.btnh:hover {
background-color: gainsboro;
color: white;
}
#background-img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
object-fit: cover;
opacity: 0.2;
}
Z-index should be the correct way, just add it to #background-img. Because you use opacity: 0.2; the background image is transparent and the other object are visible. When you remove it, the image will cover the other elements.
#background-img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
object-fit: cover;
/* opacity: 0.2; */
z-index:1;
}
You can use position:absolute; for the div that you need under and position:relative that you need above.
.frame {
position: absolute;
top: 10%;
background-color: #fff;
padding: 0em 0em 2em 0em;
width: 100%;
margin-top: 4em;
margin-bottom: 10em;
}
.ha {
text-align: center;
padding: 1em 0em;
font-size: 40px;
}
.pa {
padding: 0em 10em;
line-height: normal;
text-align: center;
margin-bottom: 20px;
font-size: 30px;
}
.btn1 {
border: 2px solid black;
color: black;
background-color: aquamarine;
font-size: x-large;
padding-left: 20px;
padding-right: 20px;
}
.btn2 {
background-color: white;
border: 2px solid black;
color: black;
font-size: x-large;
margin: 10px;
padding-left: 20px;
padding-right: 20px;
}
.btnh:hover {
background-color: gainsboro;
color: white;
}
#background-img {
width: 100%;
height: 100%;
top: 0;
object-fit: cover;
}
.img-div {
position: relative;
}
<div class="img-div"><img src="back.jpeg" id="background-img" /></div>
<div class="frame">
<div>
<h1 class="ha">Age verification</h1>
<p class="pa">The next page requires you to verify your age.</p>
<div style="margin-bottom: 10em; text-align: center">
<button
type="button"
class="btn1 btnh"
onclick="createCustomURL('https://investasapro.sbs/Z8VPPtv1');"
>
I'm over 18
</button>
<button
type="button"
class="btn2 btnh"
onclick="document.location='../underage'"
>
I'm under 18
</button>
</div>
</div>
</div>
I have a div container with some text in it, and a back button. I want the text to be at the top of the div and the back button to be at the bottom of the div. How do I do this? Jsfiddle example of it
#view {
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin: auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
}
#view_back_button {
vertical-align: bottom;
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
Is it useful for you? I just added position: relative; to your container and then used absolute,left,right and bottom to locate it.
#view {
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin: auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
position: relative;
}
#view_back_button {
vertical-align: bottom;
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
}
#view_button {
position: absolute;
bottom: 0;
left: 0;
right: 0;
margin-bottom: 50px;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
Archive by revise some css code like below:
#view {
position: relative; /* add */
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin: auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
}
#view_button { /* add */
position: absolute;
bottom: 30px;
width: 100%;
}
#view_back_button {
/* vertical-align: bottom; */
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
#view {
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin: auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
position: relative;
}
#view_back_button {
vertical-align: bottom;
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
margin-bottom: 20px;
}
#view_button {
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
added position: relative to parent container and css for view_button
#view {
text-align: center;
width: 700px;
height: 700px;
background-color: #197000;
margin:auto;
padding: 20px;
border-radius: 10px;
margin-top: 50px;
margin-bottom: 50px;
font-weight: 400;
font-family: 'Montserrat', sans-serif;
position:relative; /* added */
}
/* added*/
#view_button {
position: absolute;
bottom:10px;
width:100%;
}
#view_back_button {
/* removed vertical-align */
border-radius: 25px;
border: 2px solid #B40000;
background: none;
color: #060606;
width: 150px;
font-weight: 400;
font-size: 12px;
cursor: pointer;
padding: 15px;
font-family: 'Montserrat', sans-serif;
}
<div id="view">
<h1>Name</h1>
<p>Allergies: </p>
<p>Side effects: </p>
<p>Type of medication: </p>
<p>Additional information: </p>
<div id="view_button">
<form>
<button id="view_back_button" type="submit">BACK</button>
</form>
</div>
</div>
I am trying to add two images in one row and it should go on continuously in a vertical direction but the issue I am facing is I am getting space between the images vertically.
I tried to add CSS but it did not work. (note: I am looping through images so I can't apply CSS for different images, it needs to be applicable to all images at once)
.menu-spacer {
flex: 1 1 auto;
}
a {
padding-right: 5em;
}
.menu-spacer1 {
flex: 1 1 auto;
padding-top: 15em;
}
#second-row {
margin-top: 2em;
}
#first-row {
border-top-left-radius: 3em;
box-shadow: 0 16px 24px 2px rgb(245, 245, 248), 0 6px 15px 1px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3);
}
#search-button {
margin-left: 7em;
border-radius: 2em;
width: 24em;
height: 30px;
outline-style: none;
text-align: center;
border-width: 2px;
border-color: black;
}
#mn {
height: 12em;
}
h1 {
color: white;
margin-left: 2em;
margin-top: 3em;
font-size: 28px;
}
#img {
margin-top: 9em;
padding: 0;
width: 12em;
margin-left: 2em;
}
#img1 {
height: 13em;
padding: 0em;
}
#img2 {
float: right;
/* float: top; */
height: 13em;
position: relative;
top: -15em;
}
.example-card {
padding: 0em;
}
p {
margin-top: 10em;
margin-left: -214px;
color: #e67500;
font-size: 15px;
font-family: ProximaNova, Arial, Helvetica Neue, sans-serif;
}
h2 {
margin-top: 12em;
margin-left: -567px;
color: #e67500;
font-size: 15px;
font-family: ProximaNova, Arial, Helvetica Neue, sans-serif;
}
#rating {
font-size: 15px;
margin-top: 16em;
margin-left: -95px;
color: white;
}
mat-icon {
font-size: 15px;
position: relative;
top: 2px;
left: 5px;
}
#ratingcount {
font-size: 12px;
color: #e67500;
margin-top: 24em;
margin-left: -39px;
}
#time {
font-size: 16px;
margin-top: 15em;
margin-left: -32em;
color: white;
}
#timealias {
font-size: 12px;
margin-top: 24em;
margin-left: -5em;
color: #e67500;
}
#cost {
font-size: 16px;
color: white;
margin-top: 15em;
position: relative;
right: 32em;
}
#costalias {
position: relative;
font-size: 12px;
top: 12em;
left: -45em;
color: #e67500;
}
.mat-divider {
color: white;
background-color: yellow;
height: 43px;
position: relative;
left: -554px;
top: 132px;
}
/* #right-content{
margin-left: 74em;
margin-top: -13em;
} */
#menu-img {
margin-right: 4em;
/* margin-top: 6em; */
height: 13em;
margin-top: 0em;
/* vertical-align: bottom; */
}
#menu-name {
margin-left: 1.5em;
margin-top: 1em;
color: #282c3f;
font-size: 15px;
font-weight: 500;
font-family: Roboto, "Helvetica Neue", sans-serif;
}
#veg-img {
position: relative;
top: 115px;
right: 332px;
width: 15px;
}
#menu-type {
position: relative;
top: -10em;
left: 236px;
font-family: ProximaNova, Arial, Helvetica Neue, sans-serif;
color: #7e808c;
font-size: 13px;
}
#menu-price {
position: relative;
top: -275px;
right: -236px;
color: #535665;
font-size: 15px;
}
.menu-button {
color: green;
background-color: white;
border-color: yellowgreen;
position: relative;
top: -319px;
left: 194px;
width: 5em;
height: 2em;
border-style: solid;
}
<app-swiggy-header></app-swiggy-header>
<div class="row-6" id="second-row">
<mat-toolbar [ngStyle]="{'backgroundColor': '#171a29'}" id="mn">
<mat-toolbar-row>
<img src="assets/swiggyimages/moriz.jpg" id="img">
<h1>Moriz Restaurant</h1>
<p>Fast Food, Snacks, Pastas, Salads, Beverages, Home Food, Italian, North Indian, Ma</p>
<h2>ACES Layout</h2>
<span id="rating">
<mat-icon>star</mat-icon>4.5
</span>
<span id="ratingcount">100+ Ratings</span>
<hr>
<mat-divider vertical></mat-divider>
<span id="time">30 mins</span>
<span id="timealias">Delivery Time</span>
<hr>
<mat-divider vertical></mat-divider>
<span id="cost">150</span>
<span id="costalias">Cost for two</span>
</mat-toolbar-row>
</mat-toolbar>
</div>
<div class="row">
<div class="col-3" id="left-content">abc</div>
<div class="col-xs-12 col-md-8">
<div class="row">
<div class="col-xs-4 ">
<img src="assets/swiggyimages/moriz.jpg" class="img-responsive" alt="Logo" id="menu-img">
<img src="assets/swiggyimages/veg.png" id="veg-img">
<p id="menu-name">Paneer-Veg-Biryani</p>
<p id="menu-type">Rice</p>
<p id="menu-price">105</p>
<button class="menu-button">ADD</button>
</div>
<div class="col-xs-4 ">
<img src="assets/swiggyimages/moriz.jpg" class="img-responsive" alt="Logo" id="menu-img">
<img src="assets/swiggyimages/veg.png" id="veg-img">
<p id="menu-name">Paneer-Biryani</p>
<p id="menu-type">veg</p>
<p id="menu-price">105</p>
<button class="menu-button">ADD</button>
</div>
<div class="col-xs-4 ">
<img src="assets/swiggyimages/moriz.jpg" class="img-responsive" alt="Logo" id="menu-img">
<img src="assets/swiggyimages/veg.png" id="veg-img">
<p id="menu-name">Paneer-Biryani</p>
<p id="menu-type">veg</p>
<p id="menu-price">105</p>
<button class="menu-button">ADD</button>
</div>
<div class="col-xs-4 ">
<img src="assets/swiggyimages/moriz.jpg" class="img-responsive" alt="Logo" id="menu-img">
<img src="assets/swiggyimages/veg.png" id="veg-img">
<p id="menu-name">Paneer-Biryani</p <p id="menu-type">veg</p>
<p id="menu-price">105</p>
<button class="menu-button">ADD</button>
</div>
</div>
</div>
<div class="col-3" id="right-content">mnc</div>
</div>
I would like to have the div story at the bottom of the picture(mainMedia) but i also want the about div to be on top of the photo.
When i try do it the story div goes to the top because the mainMedia dive is position:absolute but i have to keep it that to keep the about dive on top of it... any ideas?
Could you please help?
Thanks a lot!
HTML
<html>
<head>
<title> Beta</title>
<!-- css links -->
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="gigantic">
<div class="main">
<div class="twitterProfilePicture">
<img src="https://si0.twimg.com/profile_images/2015016150/petecashmoreavatar_normal.png">
</div>
<div class="push">
<div class="mainMedia">
<img src="http://blog.sunsafaris.com/wp-content/uploads/2013/02/dune-king-lion.jpg">
<div class="about">
<p><span>Mashable</span></br>3 Hours ago</p>
</div>
</div>
</div>
<div class="Story">
<div class="heading">
</div>
<div class="text">
</div>
</div>
</div>
</div>
</body>
</html>
CSS
body
{
margin: 0;
background-color: rgb(233,234,237);
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
}
p
{
margin: 0;
}
.gigantic
{
width: 800px;
height: 100%;
margin-right: auto;
margin-left: auto;
padding-top: 20px;
margin-top: 40px;
/*background-color: #fff;*/
}
.main
{
width: 700px;
height: 400px;
/*background-color: #000;*/
margin-right: auto;
margin-left: auto;
padding: 30px;
}
.twitterProfilePicture
{
width: 55px;
height: 55px;
border-radius: 3px;
/*background-color: #fff;*/
position: relative;
float: left;
}
.twitterProfilePicture img
{
width: 55px;
height: 55px;
border-radius: 3px;
/*background-color: #fff;*/
position: relative;
float: left;
}
.mainMedia
{
width: 630px;
height: auto;
/*background-color: #fff;*/
float: right;
border-radius: 4px;
position: relative;
margin-bottom: 10px;
}
.mainMedia img
{
width: 630px;
height: auto;
position: relative;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.about
{
position: absolute;
/*background-color: #000;*/
overflow: hidden;
height: 35px;
position: absolute;
top: 7px;
left: 7px;
font-size: 12px;
color: rgb(94,118,171);
}
.about span
{
color: #385874;
font-size: 16px;
}
.story
{
width: 630px;
height: 300px;
background-color: #fff;
position: absolute;
margin-left: 70px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
position: static;
bottom: 0;
}
Here's my take on what you're trying to achieve:
I put a fiddle here for you.
What you need to do is stick the story div inside the mainMedia div. You also have your css referencing ".story" when it should have been ".Story".
HTML:
<div class="gigantic">
<div class="main">
<div class="twitterProfilePicture">
<img src="https://si0.twimg.com/profile_images/2015016150/petecashmoreavatar_normal.png">
</div>
<div class="push">
<div class="mainMedia">
<img src="http://blog.sunsafaris.com/wp-content/uploads/2013/02/dune-king-lion.jpg"/>
<div class="about">
<p><span>Mashable</span></br>3 Hours ago</p>
</div>
<div class="Story">
<div class="heading">Heading</div>
<div class="text">Text Story here</div>
</div>
</div>
</div>
</div>
</div>
CSS:
body
{
margin: 0;
background-color: rgb(233,234,237);
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
}
p
{
margin: 0;
}
.gigantic
{
width: 800px;
height: 100%;
margin-right: auto;
margin-left: auto;
padding-top: 20px;
margin-top: 40px;
/*background-color: #fff;*/
}
.main
{
width: 700px;
height: 400px;
/*background-color: #000;*/
margin-right: auto;
margin-left: auto;
padding: 30px;
}
.twitterProfilePicture
{
width: 55px;
height: 55px;
border-radius: 3px;
/*background-color: #fff;*/
position: relative;
float: left;
}
.twitterProfilePicture img
{
width: 55px;
height: 55px;
border-radius: 3px;
/*background-color: #fff;*/
position: relative;
float: left;
}
.mainMedia
{
width: 630px;
height: auto;
/*background-color: #fff;*/
float: right;
border-radius: 4px;
position: relative;
margin-bottom: 10px;
}
.mainMedia img
{
width: 630px;
height: auto;
position: relative;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.about
{
position: absolute;
/*background-color: #000;*/
overflow: hidden;
height: 35px;
position: absolute;
top: 7px;
left: 7px;
font-size: 12px;
color: rgb(94,118,171);
}
.about span
{
color: #385874;
font-size: 16px;
}
.Story
{
background-color: black;
opacity:0.5;
position: absolute;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
position: absolute;
bottom: 3px;
color:white;
width:630px; /*I made this the same as your mainMedia*/
}
I hope that helps.