My original FlexSlider markup:
<div id="flex" class="flexslider">
<ol class="flex-control-nav flex-control-paging"><li><a class="flex-active">1</a></li><li><a class="">2</a></li><li><a class="">3</a></li><li><a class="">4</a></li></ol>
<ul class="slides">
<li>
<img src="assets/img/bg-1.jpg" alt="">
</li>
<li>
<img src="assets/img/bg-1.jpg" alt="">
</li>
<li>
<img src="assets/img/bg-1.jpg" alt="">
</li>
</ul>
</div>
My Current FlexSlider markup:
<div id="flex" class="flexslider">
<ol class="flex-control-nav flex-control-paging"><li><a class="flex-active">1</a></li><li><a class="">2</a></li><li><a class="">3</a></li><li><a class="">4</a></li></ol>
<ul class="slides">
<li>
<div class="slider-content">
<h2>Welcome Jack</h2>
<p>This is a numch of dummy text jusrt to take up some space s o that I can see how it will ook like with all these characters being taken up in the world of the of uds this is a nothis is a noahtest test I hope that I can do this as possible.</p>
</div>
<img src="assets/img/bg-1.jpg" alt="">
</li>
<li>
<div class="slider-content">
<h2>Welcome Bob</h2>
<p>This is a numch of dummy text jusrt to take up some space s o that I can see how it will ook like with all these characters being taken up in the world uds this is a nothis is a noahtest test I hope that I can do this as possible.</p>
</div>
<img src="assets/img/bg-1.jpg" alt="">
</li>
<li>
<div class="slider-content">
<h2>Welcome Dan</h2>
<p>This is a numch of dummy text jusrt to take up some space s o that I can see how it will ook like with all these characters being taken up in the world of uds this is a nothis is a noahtest test I hope that I can do this as possible.</p>
</div>
<img src="assets/img/bg-1.jpg" alt="">
</li>
</ul>
</div>
as you can see I added this before the images:
<div class="slider-content">
<h2>Welcome Jack</h2>
<p>This is a numch of dummy text jusrt to take up some space s o that I can see how it will ook like with all these characters being taken up in the world of the of uds this is a nothis is a noahtest test I hope that I can do this as possible.</p>
</div>
Now the problem is that I can only get it to where I want it within the slide if I position .slider-content absolute because if I do not I get the slider-content on top of the slider with a huge margin above it. But if I posistion it absolute it does not work within the sliders. The slider-content will not change along with the slides it will just sit ontop of them. So then I tried positioning it relative and I managed to get it where I want to to be with left: 600px; top: 300px; but then the huge margin on top of the slider where the .slider-content should have been still remains there. And it is not a real "Margin" it's as if its part of the <li>'s height. Hope this makes sense but to sum it all up I just want to be able to add content within my sliders.
This should work for you, it adds a title to the slider.
var $flexslider = $('.flexslider');
$flexslider.flexslider({
animation: "slide",
manualControls: ".flex-control-nav li",
useCSS: false /* Chrome fix*/
});
.flexslider, .flexslider-controls {
max-width: 800px;
}
.slide_text {
background-color: transparent;
background-color: rgba(0, 0, 0, 0.5); /* FF3+, Saf3+, Opera 10.10+, Chrome, IE9 */
bottom: 0;
color: #fff;
display: block;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000); /* IE6–IE9 */
left: 0;
padding: 1em;
position: absolute;
width: 100%;
zoom: 1;
}
.slide_title {
font-size: 1.2em;
text-transform: uppercase;
}
.slide_byline {
font-size: 0.8em;
display: block;
}
.flex-control-nav li {
background: #000;
border-right: solid #fff 1px;
color: #fff;
cursor: pointer;
float: left;
margin: 0.09em 0 0 0;
padding: 1em 1.5em;
vertical-align: middle;
width: 25%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.flex-control-nav li:last-child {
border: none;
}
.flex-control-nav .flex-active {
background: #ccc;
color: #000;
}
/* Minified FlexSlider CSS with Chrome fix */
.flex-container a:active,.flexslider a:active,.flex-container a:focus,.flexslider a:focus{outline:0}.slides,.flex-control-nav,.flex-direction-nav{margin:0;padding:0;list-style:none}.flexslider{margin:0;padding:0}.flexslider .slides>li{display:none;/*-webkit-backface-visibility:hidden;*/position:relative}.flexslider .slides img{width:100%;display:block}.flex-pauseplay span{text-transform:capitalize}.slides:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}html[xmlns] .slides{display:block}* html .slides{height:1%}.no-js .slides>li:first-child{display:block}.flexslider{background:#fff;position:relative;zoom:1}.flex-viewport{max-height:2000px;-webkit-transition:all 1s ease;-moz-transition:all 1s ease;transition:all 1s ease}.loading .flex-viewport{max-height:300px}.flexslider .slides{zoom:1}.carousel li{margin-right:5px}.flex-direction-nav{*height:0}.flex-direction-nav a{width:30px;height:30px;margin:-20px 0 0;display:block;background-position: 0 0;background-repeat: no-repeat;position:absolute;top:50%;z-index:10;cursor:pointer;text-indent:-9999px;opacity:0;-webkit-transition:all .3s ease}.flex-direction-nav .flex-next{background-position:100% 0;right:-36px}.flex-direction-nav .flex-prev{left:-36px}.flexslider:hover .flex-next{opacity:.8;right:5px}.flexslider:hover .flex-prev{opacity:.8;left:5px}.flexslider:hover .flex-next:hover,.flexslider:hover .flex-prev:hover{opacity:1}.flex-direction-nav .flex-disabled{opacity:.3!important;filter:alpha(opacity=30);cursor:default}.flex-control-nav{width:100%;text-align:center}.flex-control-nav li{zoom:1;*display:inline}.flex-control-paging li a{width:11px;height:11px;display:block;background:#666;background:rgba(0,0,0,0.5);cursor:pointer;text-indent:-9999px;-webkit-border-radius:20px;-moz-border-radius:20px;-o-border-radius:20px;border-radius:20px;box-shadow:inset 0 0 3px rgba(0,0,0,0.3)}.flex-control-paging li a:hover{background:#333;background:rgba(0,0,0,0.7)}.flex-control-paging li a.flex-active{background:#000;background:rgba(0,0,0,0.9);cursor:default}.flex-control-thumbs{margin:5px 0 0;position:static;overflow:hidden}.flex-control-thumbs li{width:25%;float:left;margin:0}.flex-control-thumbs img{width:100%;display:block;opacity:.7;cursor:pointer}.flex-control-thumbs img:hover{opacity:1}.flex-control-thumbs .flex-active{opacity:1;cursor:default}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="flexslider">
<ul class="slides">
<li>
<img src="http://flexslider.woothemes.com/images/kitchen_adventurer_cheesecake_brownie.jpg" width="800" height="504" alt="" />
<div class="slide_text">
<div class="slide_title">Title of Slide 1</div>
<div class="slide_byline">Teaser text for slide 1</div>
</div>
</li>
<li>
<img src="http://flexslider.woothemes.com/images/kitchen_adventurer_lemon.jpg" width="800" height="504" alt="" />
<div class="slide_text">
<div class="slide_title">Title of Slide 2</div>
<div class="slide_byline">Teaser text for slide 2</div>
</div>
</li>
<li>
<img src="http://flexslider.woothemes.com/images/kitchen_adventurer_donut.jpg" width="800" height="504" alt="" />
<div class="slide_text">
<div class="slide_title">Title of Slide 3</div>
<div class="slide_byline">Teaser text for slide 3</div>
</div>
</li>
<li>
<img src="http://flexslider.woothemes.com/images/kitchen_adventurer_caramel.jpg" width="800" height="504" alt="" />
<div class="slide_text">
<div class="slide_title">Title of Slide 4</div>
<div class="slide_byline">Teaser text for slide 4</div>
</div>
</li>
</ul>
</div>
<div class="flexslider-controls">
<ol class="flex-control-nav">
<li>Slide 1 Control</li>
<li>Slide 2 Control</li>
<li>Slide 3 Control</li>
<li>Slide 4 Control</li>
</ol>
</div>
Related
I'm trying to make an informative website about the colosseum with buttons to show/hide text. I put some images with align=left so the information is next to it, but the buttons after the images are being re-aligned to. Here is what it currently looks like:
image
Here is some of the html:
<div>
<div class="buttons">
<div class="murmillo" onclick="changeGladiator('Murmillo')">
Murmillo
</div>
<div class="retiarus" onclick="changeGladiator('Retiarus')">
Retiarus
</div>
<div class="secutor" onclick="changeGladiator('Secutor')">
Secutor
</div>
</div>
<span id="gladiatorTitle"></span>:
<div id="gladiatorDescriptions">
<ul id="murmillo">
<p>
<img align="left" src="images/Murmillo.jpg" width="245px" />
A murmillo typically wears a metal helmet with a stylized fish on the crest, a rectangular shield (scutum),
and a short sword (gladius). The armor worn by a murmillo is designed to protect the head, torso, and legs,
and it is made of metal or leather. The murmillo is one of the most popular types of gladiators in ancient
Rome, and they are often pitted against other types of gladiators, such as the retiarius or secutor.
</p>
</ul>
<ul id="retiarus">
<p>
<img align="left" src="images/Retiarius.jpg" width="245px" />
A retiarius fights using a net, trident, and a small sword called a pugio. Retiarii are often pitted against
secutores, who are armed with a sword and a shield. The retiarius is lightly armed and wears little armor,
so they rely on their speed and agility to evade their opponents. Retiarii are also known for their
distinctive outfits, which include a tunic, a loincloth, and a fish-shaped helmet.
</p>
</ul>
<ul id="secutor">
<p>
<img align="left" src="images/secutor.jpg" width="245px" />
Secutors are heavily armed and trained to fight other gladiators, typically a murmillo or a retiarius. Their
armor and weaponry are designed to mimic those of a soldier, and they are known for their strong, muscular
build. They are also characterized by their helmet, which has a narrow opening that limits their vision and
makes them more reliant on their other senses. The secutor's helmet also has a crest that is shaped like a
fish, which gives them their name (secutor is Latin for "pursuer").
</p>
</ul>
</div>
</div>
<div>
<div class="buttons">
<div class="snacks" onclick="changeOther('Snacks')">
Snacks
</div>
<div class="celebrities" onclick="changeOther('Celebrities')">
Celebrities
</div>
<div class="other events" onclick="changeOther('Other Events')">
Other Events
</div>
</div>
<span id="otherTitle"></span>:
<div id="otherDescriptions">
<ul id="snacks">
<li>Olives</li>
<li> Fruits:
<ul>
<li>Figs</li>
<li>Grapes</li>
<li>Cherries</li>
<li>Blackberries</li>
<li>Peaches</li>
<li>Plums</li>
<li>Melons</li>
</ul>
</li>
<li> Nuts:
<ul>
<li>Walnuts</li>
<li>Hazelnuts</li>
<li>Pine Nuts</li>
</ul>
</li>
</ul>
<ul id="celebrities">
<li>Built during the reign of the Flavian emperors</li>
<li>In construction under Emperor Vespasian's Reign</li>
<li>Emperor Titus celebrated the opening day with 100 days of glagiatorial games</li>
<li>Emperor Commodus performed in arena</li>
</ul>
<ul id="other events">
<li>Dramas</li>
<li>Reenactments</li>
<li>Performances</li>
</ul>
</div>
</div>
And the css:
html, body {
height: 100%;
width: 100%;
margin: 0px;
overflow: hidden;
overflow-y: scroll;
background: linear-gradient(125deg, #FFCA00 0%, #FFA000 100%);
}
.title {
width: 100%;
background-color: #000000;
border-radius: 0 0 70px 70px;
color: white;
font-size: 5rem;
text-align: center;
}
.body {
margin: 50px 10%;
font-family: Arial, Helvetica, sans-serif;
}
.buttons {
display: flex;
position: relative;
right: 15px;
column-gap: 31px;
padding-bottom: 27px;
}
.buttons>* {
cursor: pointer;
background: black;
width: auto;
display: inline;
border-radius: 50px 50px 50px 50px;
padding: 10px;
color: white;
}
img:not(.title>img){
padding-right: 25px;
border-radius: 20px 20px 20px 20px;
}
Any idea on what I could do?
Wrap your divs somehow like this:
<div class="container">
<div class="image-wrapper">
<img src="" alt="">
</div>
<div class="text-wrapper">
<p>Upper description text</p>
<div class="buttons-description-wrapper">
<!-- buttons with the description they are supposed to show -->
</div>
</div>
</div>
And then the CSS would be something like this
.container {
display:flex;
flex-direction:column;
/*use those for general layout*/
/*use the following for some better positioning*/
justify-content:center; /*to center it horizontaly*/
align-items:flex-start /*to align items to the top within this container*/
}
/*setting height properties on wrappers might be needed, depends on how much text are goiing to be displaying*/
Try this and let me know.
.item_one_image {
border: 1px solid #ccc;
width: 160px;
padding: 4px 0px 10px 14px;
height: 250px;
}
<div class="article">
<div id="title_1">
</div>
<div class="item_one_image">
<img src="#" />
</div>
<div class="description_box_1">
<div class="price_1">
<span>PRICE:</span>
</div>
<li class="description_os">
<ul>OS</ul>
</li>
<li class="descrption_ram">
<ul>RAM</ul>
</li>
<li class="descrption_storage">
<ul>STORAGE</ul>
</li>
</div>
</div>
I want to add price,OS,RAM right beside phone image.
Here is my image:demo-one
I have tried:
float:right;
margin:
with float property im able to move it to right side but with margin im not able to move it up and left.
Even if i manage to move it to right beside image,it breaks on smaller sized devices.
.item_one_image {
border: 1px solid #ccc;
width: 160px;
padding: 4px 0px 10px 14px;
height: 250px;
float:left;
}
.description_box_1{
float:left;
margin-left:25px;
}
ul{
margin:0;
}
<div class="article">
<div id="title_1">
</div>
<div class="item_one_image">
<img src="#" />
</div>
<div class="description_box_1">
<div class="price_1">
<span>PRICE:</span>
</div>
<ul>
<li class="description_os">
OS
</li>
<li class="description_ram">
Ram
</li>
<li class="description_storage">
Storage
</li>
</ul>
</div>
</div>
You have put ul in li , which is wrong.
ul is a parent of li , so li must be in ul.
Is this the same that you want?
Hope this helps.
To keep the image and text on 1 line, here is 2 good solutions that does, even on smaller devices.
Note, since an ul need a li, I removed your inner ul's
First, the most classical one, using BFC float on the image and a margin-left on the text.
This avoid issues like white spaces with inline block and width calculation when using float, or inline-block, on both elements.
.item_one_image {
border: 1px solid #ccc;
width: 160px;
padding: 4px 0px 10px 14px;
height: 250px;
float: left;
}
.description_box_1 {
margin-left: 176px; /* 160px width + 14px padding + 1px + 1px border */
}
<div class="article">
<div id="title_1">
</div>
<div class="item_one_image">
<img src="http://lorempixel.com/160/250/technics/7/" />
</div>
<div class="description_box_1">
<div class="price_1">
<span>PRICE:</span>
</div>
<ul>
<li class="description_os">
OS
</li>
<li class="descrption_ram">
RAM
</li>
<li class="descrption_storage">
STORAGE
</li>
</ul>
</div>
</div>
Second, a more modern solution, using Flexbox
.article {
display: flex;
}
.item_one_image {
border: 1px solid #ccc;
padding: 4px 0px 10px 14px;
}
.description_box_1 {
flex: 1; /* take all the remaining space */
}
<div class="article">
<div id="title_1">
</div>
<div class="item_one_image">
<img src="http://lorempixel.com/160/250/technics/7/" />
</div>
<div class="description_box_1">
<div class="price_1">
<span>PRICE:</span>
</div>
<ul>
<li class="description_os">
OS
</li>
<li class="descrption_ram">
RAM
</li>
<li class="descrption_storage">
STORAGE
</li>
</ul>
</div>
</div>
List item element of html tags should be covered by your unordered list element, that means, "ul" tag should have children elements as "li"
<div class="article">
<div id="title_1">
</div>
<div class="item_one_image">
<img src="#" />
</div>
<div class="description_box_1">
<div class="price_1">
<span>PRICE:</span>
</div>
<ul>
</ul>
<li class="description_os">
OS
</li>
<li class="descrption_ram">
RAM
</li>
<li class="descrption_storage">
STORAGE
</li>
</div>
</div>
.item_one_image {
border: 1px solid #ccc;
width: 160px;
padding: 4px 0px 10px 14px;
height: 250px;
float:left;
}
.description_box_1{
float:left;
margin-left: 10px;
}
https://fiddle.jshell.net/hofh146n/
Just add .item_one_image, .description_box_1 { float: left; } code in to your CSS. And change the ul,li structure. Refer code from following HTML section.
.item_one_image {
border: 1px solid #ccc;
width: 160px;
padding: 4px 0px 10px 14px;
height: 250px;
}
.item_one_image, .description_box_1 {
float: left;
}
<div class="article">
<div id="title_1">
</div>
<div class="item_one_image">
<img src="#" alt="demo image" />
</div>
<div class="description_box_1">
<div class="price_1">
<span>PRICE:</span>
</div>
<ul>
<li class="description_os"> OS </li>
<li class="descrption_ram"> RAM </li>
<li class="descrption_storage"> STORAGE </li>
</ul>
</div>
</div>
I'm trying to learn responsive CSS but having difficulty with some basic css design. I've created a fixed navbar as you may be able to see in the code below. But the problem i'm facing is that i'm not able to properly align content below it. The content is getting overlapped by the navbar. Can you suggest an appropriate CSS fix and not a workaround like adding empty divs with fixed heights? Here is the code:
*{
box-sizing: border-box;
}
body{
margin:0px;
padding: 0px;
background-color: darkgrey;
}
.title-bar{
position:fixed;
margin-top:0px;
z-index: 100;
opacity: 1;
background-color:white;
width: 100%;
height: 100px;
border-bottom: solid 4px dodgerblue;
}
.page-container{
padding: 0px;
}
.menu-options{
list-style-type:none;
}
.menu-options li{
display: inline;
padding: 10px;
}
.menu-options li:hover{
background-color: deepskyblue;
}
.menu-options li a{
color: black;
text-decoration:none;
}
.clear20{
height: 40px;
clear: both;
}
.clear10{
height: 20px;
clear: both;
}
.display-bar-1{
background-color: deepskyblue;
height: 200px;
padding:40px;
position: relative;
}
html {
font-family: "Lucida Sans", sans-serif;
}
.caps {
text-transform: uppercase;
}
.register_button{
text-align:center;
padding-top:20px;
padding-bottom:10px;
width: 200px;
height: 70px;
border: solid 3px white;
font-style:bold;
font-size:14pt;
}
.register_button:hover{
background-color:navajowhite;
color: white;
cursor:pointer;
border-color: black;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="responsive.css" rel="stylesheet">
</head>
<body>
<div class="page-container">
<div class="title-bar">
<table width="100%">
<tr>
<td><h1> Multirater Surveys </h1></td>
<td>
<ul class="menu-options">
<li> Home </li>
<li> How It Works </li>
<li> Features </li>
<li> Surveys </li>
<li> Plans and Pricings </li>
<li> Webinars </li>
<li> Blog </li>
</ul>
</td>
</tr>
</table>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
</div>
<input type="text" class="caps"/>
<script>
window.onload = function(){
document.getElementById("register").onclick = function(){
window.location = "https://www.google.com";
}
}
</script>
</body>
</html>
`responsive.html`
The appropriate way is to add padding-top in your div, the same padding as the height of your fixed header.
I made a few changes to your responsive.css file and it worked out for me.
Here are the changes that I made:
in title-bar class
.title-bar{
position:fixed;
top: 0;
z-index: 100;
opacity: 1;
background-color:white;
width: 100%;
height: 100px;
border-bottom: solid 4px dodgerblue;
}
I changed margin-top:0px; to top: 0;
Why? To Set the top edge of the fixed positioned navbar to 0 below the top edge of its nearest positioned ancestor as told here
and in the display-bar-1
.display-bar-1{
background-color: deepskyblue;
height: 200px;
margin-top: 100px;
padding:40px;
position: relative;
}
I added margin-top: 100px;
Why? Your navbar had a height of 100px. So i gave a margin top of 100px to your display-bar-1 class.
Hope this resolves your issue.
Your navbar has a height of 100px. So you need to start with your divs 100px below.
Add to the first div after the navbar this:
style="top:100px;"
Then it should work. It would look like this:
<div class="display-bar-1" style="top:100px;">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
Other ways would be to create an own css class for the first div after the navbar. Then you could also work with
padding-top:100px;
or
margin-top:100px;
*{
box-sizing: border-box;
}
body{
margin:0px;
padding: 0px;
background-color: darkgrey;
}
.title-bar{
position:fixed;
margin-top:0px;
z-index: 100;
opacity: 1;
background-color:white;
width: 100%;
height: 100px;
border-bottom: solid 4px dodgerblue;
}
.page-container{
padding: 0px;
}
.menu-options{
list-style-type:none;
}
.menu-options li{
display: inline;
padding: 10px;
}
.menu-options li:hover{
background-color: deepskyblue;
}
.menu-options li a{
color: black;
text-decoration:none;
}
.clear20{
height: 40px;
clear: both;
}
.clear10{
height: 20px;
clear: both;
}
.display-bar-1{
background-color: deepskyblue;
height: 200px;
padding:40px;
position: relative;
}
html {
font-family: "Lucida Sans", sans-serif;
}
.caps {
text-transform: uppercase;
}
.register_button{
text-align:center;
padding-top:20px;
padding-bottom:10px;
width: 200px;
height: 70px;
border: solid 3px white;
font-style:bold;
font-size:14pt;
}
.register_button:hover{
background-color:navajowhite;
color: white;
cursor:pointer;
border-color: black;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="responsive.css" rel="stylesheet">
</head>
<body>
<div class="page-container">
<div class="title-bar">
<table width="100%">
<tr>
<td><h1> Multirater Surveys </h1></td>
<td>
<ul class="menu-options">
<li> Home </li>
<li> How It Works </li>
<li> Features </li>
<li> Surveys </li>
<li> Plans and Pricings </li>
<li> Webinars </li>
<li> Blog </li>
</ul>
</td>
</tr>
</table>
</div>
<div class="display-bar-1" style="top:100px;">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
</div>
<input type="text" class="caps"/>
<script>
window.onload = function(){
document.getElementById("register").onclick = function(){
window.location = "https://www.google.com";
}
}
</script>
</body>
</html>
I've got a weird rendering issue in IE concerning an inline unordered list. What I'm trying to do is make a visualizer for the lifespan of a project, but whenever I try to add in any text in my <p> object designed to hold a time period, it shifts the whole <li> element down, but only in Internet Explorer.
Please, take a gander at this issue: https://jsfiddle.net/xny1zv3j/
I'm okay with the name and position (ex: 'John' and 'Project Lead' being pulled down - that's not an issue for me. But in IE, and IE only, it seems as if the entire list element is pulled down. When the <p> element is empty, it's simply ignored, and is fine in all browsers, but when it has content, IE freaks out.
You should be able to simply add vertical-align: top to your .li class.
Is this what you are shooting for? https://jsfiddle.net/xny1zv3j/3/
HTML
<div class="container body-content">
<div class="container" id="main-container">
<ul class="timeline">
<li class="li" >
<div class="timestamp">
<div class="author">John</div>
<div class="date">Project Lead</div>
</div>
<div class="status">
<div class="time-period">
<p></p>
</div>
<h4>Created Project</h4>
</div>
</li>
<li class="li" >
<div class="timestamp">
<div class="author">Jenny</div>
<div class="date">Programmer</div>
</div>
<div class="status">
<div class="time-period">
<p></p>
</div>
<h4>Built Project</h4>
</div>
</li>
<li class="li" >
<div class="timestamp">
<div class="author">Jeremy</div>
<div class="date">Marketing</div>
</div>
<div class="status">
<div class="time-period">
<p>2 yrs</p>
</div>
<h4>Advertised Project</h4>
</div>
</li>
<li class="li" >
<div class="timestamp">
<div class="author">Jack</div>
<div class="date">Sales</div>
</div>
<div class="status">
<div class="time-period">
<p></p>
</div>
<h4>Sold Project</h4>
</div>
</li>
<li class="li" >
<div class="timestamp">
<div class="author">Jebeddiah</div>
<div class="date">IT</div>
</div>
<div class="status">
<div class="time-period">
<p></p>
</div>
<h4>Defended Project</h4>
</div>
</li>
</ul>
</div>
</div>
CSS
.timeline {
text-align: left;
list-style-type: none;
display: inline-block;
margin-bottom:-23px;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 5px;
padding-right: 5px;
}
.li {
width: 150px;
display: inline-block;
}
.timestamp {
margin-bottom: 20px;
padding: 0px;
font-weight: 100;
display: block;
white-space: nowrap;
overflow: hidden;
}
.status {
padding-top: 10px;
position: relative;
transition: all 200ms ease-in;
white-space: normal;
}
.status h4 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
padding-bottom: 3px;
}
.time-period {
display: inline;
text-align: center; }
.time-period p {
/* margin: -30px 0px 20px;*/
}
.time-period p:empty {
display:inline-block;
}
I'm relatively new at this level of complexity – at any rate, creating a webpage on the Squarespace platform which will feature a code block that presents a grid of 12 clickable tiles with Hover response and click through functionality. While Squarespace has built in responsiveness, whatever is in the code block is exempt from that.
So, the problem I'm having is that my nicely centered grid of 12 tiles is only centered when displayed on a fully open browser window. As the browser window diminishes in size and the tiles begin stacking, the grid aligns to the right. I've already put the gallery in a div in order to get the original centering.
Is there a way to force centering regardless of browser size?
To see the behavior in action, change Result window size of jsfiddle:
http://jsfiddle.net/terryogara/VQ3hk/
Thank you, and here's the code:
<style type="text/css">
.caption-style-1 li{
list-style-type: none;
margin: 0px;
padding: 5px;
position: relative;
overflow: hidden;
}
.caption-style-1 li:hover .caption{
opacity: 1;
}
.caption-style-1 li:active .caption{
opacity: .5;
}
.caption-style-1 img{
float: left;
}
.caption-style-1 .caption{
cursor: pointer;
position: absolute;
opacity: 0;
-webkit-transition:all 0.45s ease-in-out;
-moz-transition:all 0.45s ease-in-out;
-o-transition:all 0.45s ease-in-out;
-ms-transition:all 0.45s ease-in-out;
transition:all 0.45s ease-in-out;
}
.caption-style-1 .blur{
background-color: rgba(0,0,0,0.65);
height: 180px;
width: 180px;
position: relative;
}
.caption-style-1 .caption-text{
position: absolute;
width: 180px;
height: 180px;
text-align: center;
top:10px;
}
.outer-container {
width: 100%;
min-width: 980px
margin: 0 auto;
text-align: center;
}
.inner-container {
display: inline-block;
}
</style>
<!-- CONTENT -->
<!-- OUTER CONTAINER -->
<div class="outer-container">
<ul class="caption-style-1">
<!-- ROW 1 TOP | IMAGE GALLERY 1 -->
<div class="inner-container">
<!-- IMAGE 1 -->
<div style="float: right;">
<div style="float: right;">
<a href="http://www.example.com">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
<!-- IMAGE 2 -->
<div style="float: right;">
<a href="http://www.google.com">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
</div>
<!-- IMAGE 3 -->
<div style="float: right;">
<div style="float: right;">
<a href="http://http://stackoverflow.com/">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
<!-- IMAGE 4 -->
<div style="float: right;">
<li>
<img src="http://murmurhaus.com/wp-content/uploads/2014/07/ph-180x180.png" height="180" width="180" alt="ALT">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>TEXT HERE</h1>
</div>
</div>
</li></a>
</div>
</div>
<!-- END GALLERY 1-->
<!-- CLOSE INNER CONTAINER -->
</div>
<!-- CLOSE OUTER CONTAINER -->
</ul>
</div>
<!-- END ROW 1 -->