I am using OpenLayers 3 to make a interactive game map. I want to have side panels on the right and left side, both of them have two containers on the inside, but the map must be able to go under those containers. Makes it more visually pleasing as it goes into the margin of the two containers. I used z-index for that.
I have float: left;on the left sidepanel, and float:right; on the right sidepanel but they seem to make no diffrence.
I included LEFT and RIGHT in the titles on the top container so I know if they are floating propertly. They aren't since there is nothing on the right and the right side is above the left side.
HTML
<div id="map" class="map"><!--Map DIV, contains all of the webpage content-->
<!--Left SideBar-->
<div class="sidebar-left">
<div class="container-top">
<h3>Miscreated interactive map LEFT</h3>
<p>You can use this map to find your location and navigate through the wasteland of Miscreated.
Also you can make your own waypoints on the map and <b>share them with friends</b>! </p>
<h4>Sign in for markers · Make new Group? </h4>
<form>
<input type="text" name="groupname" placeholder="Group name" class="glowing-border" style="height: 20px; width: 48%;">
<input type="text" name="secret" placeholder="Secret" class="glowing-border" style="height: 20px; width: 48%;">
</form>
</div>
<div class="container-bottom">
map version: 0.1 <i>game version: .40</i>
<h3>Interactive Map Development</h3>
<h3>Upcoming changes to interactive map</h3>
<ul>
<li>User placed markers/waypoints</li>
<li>Login/Clan system</li>
<li>More resposive design</li>
</ul>
<p>I spend a lot of time developing this map, any feedback or suggestions for the development of this project are more then welcome. <b>Visit discussion on forums</b></p>
</div>
</div>
<!--Right SideBar-->
<div class="sidebar-right">
<div class="container-top">
<h3>Miscreated interactive map RIGHT</h3>
<p>You can use this map to find your location and navigate through the wasteland of Miscreated.
Also you can make your own waypoints on the map and <b>share them with friends</b>! </p>
<h4>Sign in for markers · Make new Group? </h4>
<form>
<input type="text" name="groupname" placeholder="Group name" class="glowing-border" style="height: 20px; width: 48%;">
<input type="text" name="secret" placeholder="Secret" class="glowing-border" style="height: 20px; width: 48%;">
</form>
</div>
<div class="container-bottom">
map version: 0.1 <i>game version: .40</i>
<h3>Interactive Map Development</h3>
<h3>Upcoming changes to interactive map</h3>
<ul>
<li>User placed markers/waypoints</li>
<li>Login/Clan system</li>
<li>More resposive design</li>
</ul>
<p>I spend a lot of time developing this map, any feedback or suggestions for the development of this project are more then welcome. <b>Visit discussion on forums</b></p>
</div>
</div>
</div>
CSS
.map {
position: relative;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
min-height: 100%;
height: 100%;
}
.sidebar-left {
position: absolute;
z-index: 3;
float: left;
width: 25%;
}
.sidebar-right {
position: absolute;
z-index: 3;
float: right;
float:right;
width: 25%;
}
.container-top {
background-color: #f2f2f2;
padding: 1% 1% 1% 1%;
margin: 2% 2% 2% 2%;
outline: none;
border-style: solid;
border-width: 3px;
border-radius: 2px;
border-color: #9ecaed;
box-shadow: 0 0 10px #9ecaed;
}
.container-bottom {
background-color: #f2f2f2;
padding: 1% 1% 1% 1%;
margin: 5% 2% 2% 2%;
outline: none;
border-style: solid;
border-width: 3px;
border-radius: 2px;
border-color: #9ecaed;
box-shadow: 0 0 10px #9ecaed;
}
Alright this is getting weird, but I have solved my own problem again. Instead of using a float, I am using the left property, since I know that my sidebar is 25% wide I just need to move it 75% left.
You could try the clear: both; property. However, if you setup a jsfiddle for this I can have a further look. This would probably be a better solution than using absolute positioning. However, if absolute is the way for you then that is fine, but I would try to use the clear property as stated above.
Related
The above link is the html and css for a tribute page I am creating for a FCC challenge. I have been having trouble adding padding to my .life and .work divs.
Also as you can see at the minute my text is not contained to the div. I have been googling this problem for a couple of hours now and all the solutions have not worked for me.
Can anyone help me out?
Ideally I would like those grey divs slightly rounded off, centered, with the text confined to the div.
codepen
Are you looking for something like this?
body {
margin-top: 60px;
}
img {
border-radius: 10%;
max-width: 50%;
display: block;
margin: auto auto 30px auto;
}
.life {
background: darkgrey;
max-width: 80%;
margin: 20px auto;
border-radius: 25%;
padding: 25px 50px;
}
.work {
background: darkgrey;
max-width: 90%;
margin: 20px auto;
padding: 25px 50px;
}
.wiki {
margin-top: 50px;
}
<div class="container">
<div class="jumbotron">
<h1 class="text-center">Zach Braff</h1>
<h2 class="text-center"><em>Actor Director Writer Producer</em></h2>
<img src="https://pbs.twimg.com/profile_images/588958455370625025/xm8yowKs.jpg" alt="Zach Braff">
<div class="life">
<h3 class="text-center">His life (summarised)</h3>
<p>Born in 1975, Zach Braff grew up in New Jersey and began acting at an early age. He got his first acting job on a TV pilot at age 14, with his first film role coming a few years later. After graduating from Northwestern University's film school,
Braff returned to acting, appearing in several small movies. His big break came in 2001 when he landed one of the lead roles on the TV comedy Scrubs. The show was a hit, and Braff became a household name. This success led to others, such as his
writing, directing and starring in Garden State, a critically acclaimed indie film, and landing a role in 2013's big-budget movie Oz the Great and Powerful.</p>
</div>
<div class="work">
<h3>His Work (some of)</h3>
<ul>
<li>Scrubs</li>
<li>Garden State</li>
<li>Oz the Great and Powerful</li>
<li>Wish I Was Here</li>
<li>Going In Style</li>
</ul>
</div>
<p class="text-center wiki"><em>Read more about Zach Braffs life and work here</em></p>
</div>
</div>
<footer>
<p class="text-center">Personal project for FCC's assignment 'Build a Tribute Page</p>
</footer>
Do you want something like this?
Solution
Changes:
.life {
background: darkgrey;
max-width: 80%;
margin: 20px auto;
padding:4em;
border-radius: 25%;
}
.work {
background: darkgrey;
max-width: 90%;
padding:4em;
margin: auto;
}
I just added padding to both the classes and it worked!
I have two main divs service-display-box and service-contact.
service-contact is not setting properly after service-display-box, which has floated divs inside of it.
Let me first state that I am using clear: both; after the floated div. In addition, service-contact is reading the margin, but it is starting it halfway into the service-display-box.
I am not sure what I am doing wrong. It works in the snippet, but not on my page.
What am I doing wrong?
#service-display-box {
background: #FFF;
color: #000;
width: 100%;
padding: 15px 0;
}
#service-display-box-container {
padding: 135px 15%;
}
.service-item-box-img-container {
width: 80%;
margin: 50px 10%;
}
.service-item-box-img {
margin: 50px 0;
width: 40%;
height: auto;
vertical-align: top;
box-shadow: 8px 8px 4px #BEBEBE;
}
.service-item-box-img.left {
float: left;
}
.service-item-box-img.right {
float: right;
}
#service-contact {
margin: 225px auto 75px auto;
text-align: center;
clear: both;
}
#service-contact a {
text-decoration: none;
}
#service-contact-button {
border: 1px solid #578570;
background: #578570;
color: #FFF;
padding: 20px 40px;
font-size: 1.5em;
transition: 0.4s ease;
-webkit-transition: 0.4s ease;
}
<div id="service-display-box">
<div id="service-display-box-container">
<div class="service-item-box" id="service1">
<h1 class="service-item-title">DEMOLITION</h1>
<h2 class="service-item-description">
<p>We continues to build a strong legacy in the dismantlement industry because of our proven ability to complete projects ranging in nearly any size”</p>
<p>We have played a valuable role in the demolition of numerous industrial facilities throughout the region including chemical, steel mills, energy generation, tire, and automotive. These structures demand skillful understanding along with proper tools and equipment to be safely brought down.</p>
<p>Commercial demolition is essential in the redevelopment process. The region has allowed us to complete numerous commercial projects. We are able to perform interior, selective, and full demolition services to our clients.</p>
<p>Residential demolition is a fundamental ability. We provides turnkey services to the public, the government, and development entities.</p>
</h2>
<div class="service-item-box-img-container">
<img src="images/service/demo/demo1.jpg" alt="Eslich Wrecking Company Demolition and Wrecking Services" class="service-item-box-img left">
<img src="images/service/demo/demo2.jpg" alt="Eslich Wrecking Company Demolition and Wrecking Services" class="service-item-box-img right">
</div>
</div>
<div style="clear:both;"></div>
<div id="service-contact"><span id="service-contact-button">CONTACT US</span>
</div>
You're not clearing the floats correctly:
The easiest way to expand an element with floated elements inside him is to add overflow: hidden;. So go ahead and give
.service-item-box-img-container {
overflow: hidden;
}
Your issue is in the jQuery in this line:
$('#service'+item_number).show().siblings().hide();
Which making your <div class="clear"></div> to be styled as display:none due to be a siblling of your .service-item-box divs,
To fix this is saying that the divs with class .service-item-box are the only one to be affected, so will be like this:
$('#service'+item_number).show().siblings('.service-item-box').hide();
Your div that was setting clear: both also has display: none which essentially renders it useless. Getting rid of the display: none moved the button down 225px for me
hope i understood the question.
add { float:left;width:100%} to .service-contact and the margin will be calculated correctly
also add { float:left;width:100%} to .service-top
I'm taking the Free Code Camp course thing and the first project is to create a tribute page to whoever. Mine is on J Dilla, my favorite hip hop producer. God rest his soul. Anyways I'm trying to use a bootstrap thumbnail around a picture of him, with the text/caption also inside the thumbnail. My problem is that it messes up the centering and aligns the thumbnail to the left and I have no idea how to fix it. Here's the relevant code:
<style>
.cool-text {
font-family: Lobster;
font-size: 20px;
}
.image-centering {
display: block;
margin-left: auto;
margin-right: auto;
}
.vertical-centering {
margin-top: auto;
margin-bottom: auto;
}
.gray-background {
background-color: lightgray;
margin: 20px 100px 20px 100px;
border-radius: 5px;
}
.white-background {
background-color: white;
margin: 10px 560px 10px 10px;
}
</style>
<div class="gray-background">
<br>
<h1 class="cool-text text-center">J Dilla</h1>
<h2 class="text-center"><i>The one and only</i></h2>
<br>
<div class="span8 offset2">
<div class="img-thumbnail thumbnails">
<img class="image-centering" src="http://media.lessthan3.com/wp-content/uploads/2014/02/j-dilla-lessthan3.jpg" alt="The man himself."</img>
<p class="text-center">Dilla working on something ill, I presume</p>
</div>
</div>
<br>
</div>
</div>
Also if there's anything glaringly terrible about my code, I'd love some input on how to reformat it. This is my first time asking a question on stack overflow so forgive me if this is the wrong way to do so.
jsfiddle
I'm trying to create a blog header that is best described as a grid format. Each item will have a specified position- top, bottom, left, right- with a border on each of it's sides. I've got the basic layout down, but finessing it into a pixel perfect grid is a bit beyond my reach. I've attached an image of what it should look like in the end. Below is the code.. what am I missing?
html-
<div id="blog-header">
<span class="blog-logo"><img src="http://placehold.it/262x134" alt="logo" /></span><!-- end blog-logo -->
<div class="mid">
<p class="blurb">Hi, this is a brief bio.<br/>Ok that's it!</p><!-- end blurb -->
<div class="blog-social">
<ul>
<li><img src="http://placehold.it/25x25" alt="facebook" /></li>
<li><img src="http://placehold.it/25x25" alt="twitter" /></li>
<li><img src="http://placehold.it/25x25" alt="instagram" /></li>
<li><img src="http://placehold.it/25x25" alt="pinterest" /></li>
</ul>
</div><!-- end blog-social -->
</div><!-- end mid -->
<div class="right">
<p class="blog-nav">PORTFOLIO<span style="padding: 0 5px 0 5px;">|</span>BLOG<span style="padding: 0 5px 0 5px;">|</span>ABOUT<span style="padding: 0 5px 0 5px;">|</span>CONTACT</p>
<div class="email">
<img src="http://placehold.it/350x50">
</div><!-- end email -->
</div><!-- end right -->
</div><!-- end blog-header -->
css-
#blog-header {
height: 124px;
width: inherit;
margin: 0 auto;
}
#blog-header .mid,
#blog-header .blog-logo {
border-right: 2px solid #333333;
float: left;
}
#blog-header .mid {
padding-left: 15px;
width: 230px;
}
#blog-header .right {
padding-left: 15px;
float: right;
}
#blog-header .blog-logo {
padding-right: 15px;
width: 262px;
}
#blog-header .blurb {
border-bottom: 2px solid #333333;
padding-bottom: 15px;
font-family: Alexandria;
font-size: 80%;
text-align: center;
width: 200px;
}
#blog-header .blog-social {
clear: both;
width: 125px;
margin: 0 auto;
padding: 10px 0 10px 0;
}
#blog-header .blog-nav {
padding: 7px 0 15px 0;
width: 350px;
}
#blog-header .email {
border-top: 2px solid #333333;
padding-top: 17px;
width: 350px;
}
First, try not to style tags in your HTML with id tags. In fact, if at all possible, try not to style with classes either, unless you need to. You should Google CSS Selectors and try to use as many of those to style your HTML.
Since the only image you are using is the big none on the left, you don't need to put a span around it. Just float: left the image.
Also, are you using HTML5? If so, then #blog-header should instead be a tag. If you have more than one header in your document, then you could give it a class to differentiate it if you needed to.
You also don't need a div around your unordered list of social icons. Just float the list, and display:inline the icons. And instead of using images as icons, you should Google Icon Fonts.
There's a lot more, but start there and get back to us once you've made those changes. Just remember, when it comes to HTML and CSS, less is more!
Kindly post us the part where you are stuck at, not the whole css, what you exactly want, then we can help. It's pointless when you make %90 of whole project and ask us to re-write the project as a whole so we can fix your bugs.
By the way, the codes seem to be too long for such a banner. I removed half of your css and they worked exactly same. Either you took these from somewhere or you don't have any methodolody in learning curve.
I recommend you to take professional developing courses which might help you building clear codes.
I am new to css . I am trying to display my images in a perfect manner
here is my html code:
<div id="photos">
<h3>Photo title</h3>
<P class="like">Like </P>
<p class="date">date </p>
<div id="image">
<img src="something.jpg" />
</div>
<p class="about">about image goes here</p>
</div>
Now i want to style the same like this:
http://www.desolve.org/
If you want to make your image like that wall post i did it in below given fiddle link.
http://jsfiddle.net/zWS7c/1/
Css
#photos{
margin:10px;
border:solid 1px red;
font-family:arial;
font-size:12px;
}
#photos h3{
font-size:18px;
}
.date, .like{
text-align:right;
}
.about{
margin:10px;
}
#image img{
width:100%;
}
HTML
<div id="photos">
<h3>Photo title</h3>
<P class="like">Like </P>
<p class="date">date </p>
<div id="image">
<img src="http://www.desolve.org/_images/chicago_banner.jpg" />
</div>
<p class="about">about image goes here</p>
</div>
Live demo http://jsfiddle.net/46ESp/
and now set to according to your layout as like margin *padding* with or height
I think you need like this
http://jsfiddle.net/VwPna/
From http://www.w3schools.com/css/default.asp you learn easily... and also you can check other website css from firebug in your browser.
below code is that you given site css for banner class.
.banner {
background: url("../_images/gallery_banner.jpg") no-repeat scroll 0 0 transparent;
height: 350px;
margin-bottom: 4em;
overflow: hidden;
padding-left: 3.9%;
position: relative;
}
same way you can give more style their.
Here is the way it is made on the link you gave.
HTML:
<div class="banner">
<h1>We love urban photography</h1>
<p>
We’re betting you do to. Welcome to our site, a growing collection of galleries taken by a small group of passionate urban photographers. Visit our galleries, buy some of our prints, or drop us a line. While you’re at it, feel free to submit a gallery of your own.
<strong>Welcome</strong>
.
</p>
</div>
CSS:
.banner {
background: url("../_images/gallery_banner.jpg") no-repeat scroll 0 0 transparent;
height: 350px;
margin-bottom: 4em;
overflow: hidden;
padding-left: 3.9%;
position: relative;
}
.banner h1 {
color: #FFFFFF;
font-size: 2.2em;
letter-spacing: 0.1em;
padding-top: 290px;
}
.banner p {
background: none repeat scroll 0 0 rgba(123, 121, 143, 0.8);
color: #FFFFFF;
font-size: 1em;
height: 350px;
padding: 1% 1% 0;
position: absolute;
right: 0;
top: 0;
width: 21%;
}
You only need to translate that to your id's, classes and form, then you have it
There's nothing special that they've done on the reference web site. They've used the image as a background property of a div class="preview".
Here is the (x)HTML:
<section class="chicago">
<h2>Chicago</h2>
<p class="pubdate">
<time datetime="2011-04-24" pubdate="">April 2011</time>
</p>
<div class="preview"></div>
<p class="caption">Big wind, big shoulders. See a different side of Chicago.</p>
</section>
And the corresponding CSS
.chicago .preview {
background: url(../_images/sm_chicago_banner.jpg) no-repeat;
}
You can always sneak-peek by right mouse click on the website and choosing "View Page Source" or something similar, depending on your browser :)