I can't set definitive height for these 2 columns.
I set classes for each div column, contact and about. The only way that column stretches is when I fill it with content or set it to a definitive pixel height but when I shrink the page they stack and contact row gets swallowed up by the bottom about row. example here
http://codepen.io/Chris-Brennan/pen/rOWYab?editors=110
This is what I'm trying to achieve.
<div class="container" id="contact_container">
<div class="row">
<div class="col-md-6 contact">
<p><a href="pdf/resumeChris.pdf" download>Download: Resume</a><p>
<p>emailpgh#gmail.com</p>
<img class="pull-right" src="https://d22r54gnmuhwmk.cloudfront.net/photos/8/tt/ub/WotTuBQzQzQoeZY-128x128-noPad.jpg" alt="chris">
</div> <!---contact container--->
<div class="col-md-6 about">
<p><span style="color:tomato">About Me</span> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. <span style="color:tomato">Currently seeking Junior Design position.</span></p>
</div> <!---about container--->
</div> <!---end row--->
</div> <!------end container----->
body{
font-family:'Montserrat',sans-serif;
margin-top:50px;
}
#contact_container {
height:100%;
padding:0 50px;
border:1px solid red;
overflow:hidden;
}
.contact {
height:100%;
padding:30px;
background:tomato;
}
.contact p{
font-size:1.5em;
}
.contact a{
color:white;
}
.contact img{
position:absolute;
top:20px;
right:20px;
}
.about {
height:100%;
padding:30px;
background: #34495e;
color:white;
}
/* Iphone/Android (Small Devices) ----------- */
#media only screen and (min-width : 320px) and (max-width: 767px) {
/* Styles */
#contact_container {
padding:0 50px;
}
.contact {
height:100%;
padding:30px;
background:tomato;
font-weight:700;
}
.contact p{
text-align:center;
font-size:1.5em;
}
.contact a{
color:white;
}
.contact img{
}
.about {
height:100%;
padding:30px;
background: #34495e;
color:white;
}
the grid system of bootstrap can be nested.
look this example:
<div class="col-md-6 contact">
<div class="col-xs-12-md-8">
<p><a href="pdf/resumeChris.pdf" download>Download: Resume</a></p>
<p>emailpgh#gmail.com</p>
</div>
<div class="col-xs-12-md-4">
<img class="pull-right" src="https://d22r54gnmuhwmk.cloudfront.net/photos/8/tt/ub/WotTuBQzQzQoeZY-128x128-noPad.jpg" alt="chris">
</div>
</div>
.contact img{
position: relative;
}
.contact {
text-align:center;
height:100%;
padding:30px;
background:tomato;
font-weight:700;
}
.contact p{
font-size:1.5em;
}
just make these changes in your css file for mobile view. after that just give a margin to your image if it is not aligned according to your need.
Related
I have made a tooltip on hover over an icon and it works fine in desktop view.
Working Snippet:
.tooltip {
position: relative;
display: inline-block;
}
.tooltip img {
width: 15px;
}
.tooltip .tooltiptext[data-position="bottom"] {
visibility: hidden;
width: 400px;
background-color: #fff;
color: #000;
text-align: center;
border-radius: 0.5rem;
border-width: 1px;
border-color: #e2e8f0;
padding: 5px;
position: absolute;
z-index: 1;
top: 100%;
left: 50%;
margin-left: -60px;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
<label> Some Label </label>
<span className="ml-2">
<div class="tooltip">
<img
src="https://www.svgrepo.com/show/2297/doubts-button.svg"
alt="help text"
/>
<span data-position="bottom" class="tooltiptext">
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only five
centuries, but also the leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s with the release
of Letraset sheets containing Lorem Ipsum passages, and more recently
with desktop publishing software like Aldus PageMaker including versions
of Lorem Ipsum.
</span>
</div>
</span>
Whereas in mobile view, this leads to horizontal scroll bar.
Please switch to mobile view to see the issue.
Things I tried:
I have tried removing margin-left and modified left value like,
.tooltip .tooltiptext[data-position="bottom"] {
visibility: hidden;
width: 400px;
.
.
.
.
.
left: 0%;
margin-left: 0px;
}
But this doesn't work... Kindly please help me to make this tooltip responsive in mobile devices using CSS. Big thanks in advance.
Just add the following css:
#media screen and (max-width: 576px) {
.tooltiptext {
width: 300px;
}
}
I have a text and when I press on icon I can read more, and when press on another icon I can read less. The question is that how can make indent of top, for read more and read less icons to see them below than text, and make them(icons) in the center? The icons are +, -.
This is html:
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
<input id="read-more-state-1" class="read-more-state" type="checkbox">
<span class="read-more-target">
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.
</span>
<label for="read-more-state-1" class="read-more-button">
<span class="read-more-button-icon"></span>
</label>
</p>
This is CSS:
.read-more-state {
display: none;
}
.read-more-button {
display: none;
}
#media only screen and (max-width: 600px) {
.read-more-target {
opacity: 0;
font-size: 0;
transition: .25s ease;
}
.read-more-button {
display: inline-block;
border-radius: 0.25em;
width: 1em;
height: 1em;
background: url(img/arrow%20grad.svg);
background-size: cover;
cursor: pointer;
}
.read-more-state:checked + .read-more-target {
opacity: 1;
font-size: inherit;
}
.read-more-state:checked ~ .read-more-button {
background: url(img/arrow%20up%20grad.svg);
background-size: cover;
cursor: pointer;
}
}
If you want the + and - icons to appear centered and below the text, your easiest option would be to make the p element positioned relative, and your icons positioned absolute.
p{
position: relative;
padding-bottom: 1.5em;
}
.read-more-button {
position: absolute;
bottom: 0px;
left: 50%;
}
Here is a codepen link.
If you visit this link, you can see below image at the center of the page:
On this site, if you mouse over currency symbol present on top right of window, you can see drop down options, once you change a dropdown option, you can see "Usually Delivered in 3-5 business days" text next to price - I want this text below the Price, as in the next image:
This is the CSS I am using and, it doesn't matter how I try, can't get the desired result. Can someone please have an advice for me? Thank you.
font-family: 'Roboto Condensed', sans-serif;
color: #636363;
font-size: 14px;
line-height: 1.5;
}
on
.price-info
Take off
max-width: 31%;
So that it takes up the entire line
Try taking the float:left off of your p tag. That should fix a few issues on your page and might fix the issue you're having with the text displaying in the wrong area.
You should probably also add some html and css to your question. Without it it makes it a hassle to answer.
$(document).ready(function() {
$('.qty-btn').click(function(){
if($('.qty').val() > 0)
{
$('.deliveryMsg').text('Usually Delivered in 3-5 days.');
}else {
alert("Qty must be greater than 0");
}
});
});
body {
background: silver;
}
.section {
height: 400px;
width: 500px;
margin-bottom: 20px;
background: #FFFFFF;
margin-left: 100px;
padding: 10px;
}
/* used for demo purposes */
.product-img {
background: silver;
opacity: 0.5;
height: 150px;
width: 150px;
/* center the img within the col */
display: block;
margin: auto;
}
.col-left {
width: 40%;
}
.col-right {
float: right;
margin-top:-165px;
text-align: left;
width: 60%;
}
.title {
font-weight: bold;
}
.price {
margin-top: -5px;
margin-bottom: -5px;
color: blue;
}
input[type="text"] {
width: 50px;
}
span {
font-size: small;
font-weight: bold;
}
input[type="button"] {
background: orange;
color: #FFFFFF;
}
.qty {
width: 20px !important;
}
.wishlist {
width: 130px !important;
}
.deliveryMsg {
font-weight: bold;
opacity: 0.5;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="section">
<div class="col-left">
<div class="product-img"></div>
</div>
<div class="col-right">
<p class="title" >Golden Waves Marble Texture Apple IPhone 4 Phone Case</p>
<hr />
<ul>
<li>Device: Apple iPhone 4</li>
<li>Design: Marbles</li>
<li>Material: Polycarbonate Hard Case</li>
</ul>
<hr />
<h3 class="price">499.00</h3>
<hr />
<form>
<span>Check Delivery Availability <input type="text" placeholder="Enter PIN Code" /> <input type="button" value="CHECK" /></span>
<br /><br />
<span>Qty: <input class="qty" type="text" /> <input class="qty-btn" type="button" value="ADD TO CART" /> <input class="wishlist" type="text" placeholder="SAVE TO WISHLIST" /></span>
<br /><br />
<span class="deliveryMsg"></span>
</form>
</div>
</div>
<div class="section">
<h2>Product Description</h2>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</div>
Hope that helps!
I wish to have equal height columns, so I have created a display:table container with display:table-cell children, both have height:100% set. The problem is, it works as I wished on Firefox only, but doesn't work on Chrome and IE11.
Here's the fiddle
Below is the HTML code :
<div class="featured">
<div class="row">
<div class="one-half">
<div class="light-bg">
<div class="row">
<div class="one-quarter"><div class="icon icon-server icon-1"></div></div>
<div class="three-quarter">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the le text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the le
</div>
</div>
</div>
</div>
<div class="one-half">
<div class="light-bg">
<div class="row">
<div class="one-quarter"><div class="icon icon-server icon-2"></div></div>
<div class="three-quarter">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the le
</div>
</div>
</div>
</div>
</div>
</div>
Here's the CSS :
*,
*:before,
*:after { /* Inherit box-sizing to make it easier to change the property for components that leverage other behavior; see http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ */
box-sizing: inherit;
}
.row{
margin-bottom:20px;
margin-left:-10px;
margin-right:-10px;
}
.row:before,
.row:after{
content: "";
display: table;
}
.row:after{
clear:both;
}
.one-half, .one-quarter, .three-quarter{
float:left;
padding:0 10px;
box-sizing:border-box;
}
.one-half{
width:50%;
}
.one-quarter{
width:25%;
}
.three-quarter{
width:75%;
}
.light-bg{
background:#ddd;
}
.featured > .row{
display:table;
height:100%;
}
.featured > .row .one-half{
display:table-cell;
height:100%;
float:none;
vertical-align:top;
}
.featured > .row .light-bg{
padding:20px;
border-radius:4px;
height:100%;
}
.featured > .row .light-bg .row{
margin-bottom:0;
}
.featured > .row .light-bg h6{
margin:0 0 10px 0;
color:#000;
}
.featured > .row .light-bg .icon{
text-align:center;
width:100%;
height:96px;
background:#fff;
}
Any ideas is greatly appreciated. I can't use flexbox because it's not supported in IE9.
Thank you.
Since all browsers could detect the height of .one-half correctly (except Chrome), finally I used JavaScript to set its height explicitly to solve this problem for IE (and any other browsers) because the children elements use height:100%, and one of the children with this is the element with background colour.
As for Chrome, I had to apply display:table; to .light-bg to allow correct detection of height for .one-half parent.
Make it flexible for any browsers
visit this learning site
http://www.w3schools.com/cssref/css3_browsersupport.asp
How to wrap one div around another? I have following two div ids:
#course {
width: 325px;
padding-right: 25px;
border-right: 1px solid #999;
border-top: 1px solid #999;
}
#home-page-sign-up {
width: 275px;
#padding-left: 25px;
float: right;
margin: auto;
#position: relative;
display: block;
clear: both;
}
I want #course to be on left and #home-page-sign-up on right just next to it. I do get block on left and right as assigned but one is below another, I want them to be side by side.
How can I achieve it?
You will want to float both of them left:
#course{
float:left;
width:325px;
padding-right:25px;
border-right:1px solid #999;
border-top:1px solid #999;
}
#home-page-sign-up {
width:275px;
#padding-left:25px;
float:left;
margin: auto;
#position:relative;
display:block;
}
Just make sure #course falls first in the html
Try this:
#course{
width:325px;
float:left;
padding-right:25px;
border-right:1px solid #999;
border-top:1px solid #999;
}
#home-page-sign-up {
width:275px;
#padding-left:25px;
float:left;
margin: auto;
#position:relative;
}
Then, in your body tags, do:
<div id="course">Course Div Content here...</div>
<div id="home-page-sign-up">Home Sign-up Content here...</div>
<div style="clear: left;"></div>
That's one way...that hopefully works ;)
I dont know what you mean by "wrap around" but if you want the divs to be next to each other, put float: left; in both styles...
see fiddle for code and demo
Fiddle: http://jsfiddle.net/t4LUF/3/
Demo: http://jsfiddle.net/t4LUF/3/embedded/result/
NOTE: For demo purpose i gave border to all div's you can change as per your need.
HTML:
<div id="big-container">big-container
<div id="container">
<div id="course">course Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
<div id="home-page-sign-up">home-page-sign-up </div>
</div>
</div>
SS: http://img812.imageshack.us/img812/3783/divcontainersidebyside.jpg