How to make sure Text always stays on top of Image (even when resizing)?
Tags: javascript,html,css,image,text
Problem :
SITUATION:
I have the following result for my Website:
PROBLEM:
I would like to add content on top of the iPad image so that the content is always "inside" the iPad's screen (even when resizing the window).
QUESTION:
How can achieve that ? I googled for solutions, none helped me. Is there some property to make a div snap to an image ?
CODE:
HTML:
<section class="Contact" id="Contact">
<div class="row">
<div class="col span-1-of-2" >
<h2> Contact </h2>
</div>
<div class="col span-1-of-2 rightPage" >
<img src="Vendors/Images/iPadContact.png" alt="Contact on iPad">
</div>
</div>
</section>
CSS:
section {
height: 100vh;
overflow: hidden;
padding: 0%;
}
.rightPage {
margin-top: 0%;
height: 100vh;
width: 50vh;
}
img {
max-width: 100%;
max-height: 95%;
display: block;
margin-top: 2.5%;
margin-bottom: 2.5%;
margin-left: 0;
}
Solution :
From what I understood you whant the text inside the iPad image. If that is the case try to set you'r image as background-image
:
<section class="Contact" id="Contact">
<div class="row">
<div class="col span-1-of-2" >
<h2> Contact </h2>
</div>
<div class="col span-1-of-2 rightPage" >
Some Text ...
</div>
</div>
</section>
CSS.
.rightPage {
background-image: url("Vendors/Images/iPadContact.png");
background-repeat: no-repeat;
background-size: 100%;
height: 100vh;
max-width: 517px;
}
Add the right image width to max-width
CSS Howto..
What you need is this: .snap-drawer ul ul > li { list-style-type: disc !important; } Or more simply: .snap-drawer ul ul li { list-style-type: disc; } ...
Demo: http://jsbin.com/buwexe/edit?html,css,output If you don't want to clutter the UI with divs then you will have to use descriptive classes which are not reusable. The purpose of a grid is...
I would suggest to use JSoup library to do it as its pretty good HTML parse. You can parse HTML and than iterate over resources to download them. I am...
All scrollbar can be different according to browser and OS so you must use javascript. I found a cool snippet here : http://davidwalsh.name/detect-scrollbar-width And that an exemple : http://jsfiddle.net/a1m6an3u/ The...
Ok, I've found a solution. Whether it's the best solution, I don't know, but it works and that, frankly, is all I care about, having spent almost a day on...
I would do the following. Use absolute positioning to place .controls_prev to the left and .controls_next to the right. Keep .controls_toggle in regular flow and use margin: 0 auto to...
Just use table thead th[colspan] According to the CSS 2.1 spec, [att] Match when the element sets the "att" attribute, whatever the value of the attribute. ...
These spaces are actually caused by the white space in your html. To solve, add float: left to your <li> tags: .nav li { float: left; } To see that...
Try using display:inline-block; https://jsfiddle.net/ex3ntia/DTcHh/22030/ .input-group-btn {display:inline-block;} ...
Browser will try to take first font, second font and if it wont be able to find it it will serve a sans serif system font .AgendaText { font-family: arial,...
I would suggest something like: // Get all files string filepath = Environment.GetFolderPath("Filepath here"); DirectoryInfo d = new DirectoryInfo(filepath); //Handle each file foreach (var file in d.GetFiles("*.html")) // Get all...
Add this line in your css flie: body { padding-top: 50px; } or: .some-text { padding-top: 50px; } ...
I'm the author of the plugin. I'm rewriting it right now and right after that I'll write the example. In the callback, you can save the JSON object with the...
This gives pretty similar output to what you want. Try tweaking the values of border-radius and height-width to achieve exactly what you want. <style> #pic { position: relative; width: 130px;...
Just change the initial value of clicked var clicked = false; $(".crossRotate").on('click', function () { if (clicked) { clicked = false; $(".content-wrapper").css({ "bottom": "-90px" }); } else { clicked =...
Firebug is your friend. ...
It is really pretty simple. Create a class that describes the fixed positioning. Monitor the scroll event of the window. If the top of the social media are going to...
Maybe you could use a historical version of CSSBox that is based on CSSParser instead of the newer jStyleParser. It is probably less efficient (all data is represented as strings)...
You can use Css like this, .btnCustom, .btn-info { background-color: #6fb3e0!important; border-color: #6fb3e0; } .btnCustom ,.btn{ padding:5px 10px; } .btnCustom ,.btn-custom{ height:20px; } and Html <input type="button" class="btn-custom btn btn-info"...
You'll want something like: <div class="nameofclass">Some contents</div> Avoid the center tag; it's not supported. If you need the element to appear centered, do it in the CSS. As already stated,...
You can do that using a comma: @media all and (min-width:481px) and (max-width:1024px), all and (max-height:900px) ...
If you want to hide the header of the outer table: #userList thead { display: none; } If you want to hide all of the headers of the inner table:...
There's no default direction for transitioning the properties. And ease-out is just a transition timing function: From the Spec: The transition-timing-function property describes how the intermediate values used during a...
If someone suggests, don't #upper a {display:none !important;} as this introduce more issues in the future than it would sove immediately. #upper a {display:none;} would work unless there is a...
You might want this #second{ background:blue; overflow:hidden } input{ width:100% } Js Fiddle Demo ...
The problem is in your css. you have the following declared: #jsddm > li a:hover { background: #FFF; color: #4370b6; padding: 0 15px; -moz-box-shadow: 0 3px 5px rgba(0,0,0,17); -webkit-box-shadow: 0...
I cannot recreate the issue, as it seems to work fine in this demo (note: opacity was changed just to make it more obvious). However, a few things to note...
The problem is not with the precedence. I figured out that it should be vertical-align: middle instead of vertical-align: center This works....
OK, this is a little off-putting if you've not used Sass before but take a look at my example on Codepen. Sass is a great tool to "programmatically" adjust colors...
Try This working one. DEMO at JSBin HTML: <div id="container"> <div id="bottomContainer"> <div id="buttonDiv"> <button id="generateButton">Generate Statement</button> </div> <div id="requiredDiv"> </div> </div> <div id="demoText"> <p>Lorem Ipsum is simply dummy...