I want to display images inline, but instead of this they appear vertically and the horizontal scrollbar isn't come up. How can i make the screen scrollable without define exact width and how can i format the images to smaller than the screen vertically without explicit height? No js tricks. Thx
<section class="project-section">
<ul class="list-inline">
<li>
<article class="project-data">
<h1>#Model.CurrentTitleText()</h1>
<p>#Model.CurrentDescriptionText()</p>
</article>
</li>
#foreach (var elem in Model.ProjectInclude)
{
<li>
<article class="project-item-container fit-container">
<img class="fit-container" src="#Url.Action("Render", "Image", new { file = elem.Media.FileName })/" />
#if (!string.IsNullOrEmpty(elem.Media.CurrentTitleText()))
{
<h6>#elem.Media.CurrentTitleText()</h6>
}
#if (!string.IsNullOrEmpty(elem.Media.CurrentDescriptionText()))
{
<p>#elem.Media.CurrentDescriptionText()</p>
}
</article>
</li>
}
</ul>
Css:
.project-section {
padding-top: 50px;
padding-bottom: 50px;
max-height: 100%;
}
.fit-container {
max-width: 100%;
max-height: 100%;
}
.project-itemlist {
max-height: 100%;
}
.project-item-container {
max-height: 100%;
}
You have to make your list display inline:
CSS:
.list-inline li{
display:inline-block;
}
I made a codepen and mocked up your html. When I do so it displays correctly. I would suggest you check to ensure bootstrap is being loaded. The list-inline class is already set to display: inline-block if your properly loading bootstrap.
<section class="project-section">
<ul class="list-inline">
<li>
<article class="project-data">
<h1>Inline Images</h1>
<p>Lorem ipsum</p>
</article>
</li>
<li>
<article class="project-item-container fit-container">
<img class="fit-container" src="http://www.placehold.it/200x200" />
<h6>Sample text</h6>
<p>Lorem ipsum blah blah blah</p>
</article>
</li>
<li>
<article class="project-item-container fit-container">
<img class="fit-container" src="http://www.placehold.it/200x200" />
<h6>Sample text</h6>
<p>Lorem ipsum blah blah blah</p>
</article>
</li>
<li>
<article class="project-item-container fit-container">
<img class="fit-container" src="http://www.placehold.it/200x200" />
<h6>Sample text</h6>
<p>Lorem ipsum blah blah blah</p>
</article>
</li>
</ul>
.project-section {
padding-top: 50px;
padding-bottom: 50px;
max-height: 100%;
}
.fit-container {
max-width: 100%;
max-height: 100%;
}
.project-itemlist {
max-height: 100%;
}
.project-item-container {
max-height: 100%;
}
Related
I am trying to move an image underneath the text. I tried (position: absolute) and moving the image with -px but I want the image to stay in the same place on the HTML but have it moved using only CSS. I am doing a mobile-first approach and because of the desktop design, the IMG has to stay at the same position in HTML. I also tried to moving the text but it just goes over the image or the padding and just doesn't work. It might be easier to explain by screenshots:
The results I want to achieve:
And my current results are:
And my current code is:
img {
display: block;
width: 50%;
}
<header id="titleHeader">
<h1><span id="boot">Example</span>Text</h1>
<a class="navbutton" href="#navbar">Menu</a>
</header>
<section id="intromessage">
<img alt="shoes" src="https://cdn11.bigcommerce.com/s-h8hjw/products/927/images/735/WBHQ19-Retail-Product-OnWhite-Boots-M-1500x1425__00368.1599677007.475.500.png?c=2">
<div>
<h2>Example Text</h2>
<p>
example text, example text, example text<span> example text </span>example text
<span>example text</span>
</p>
</div>
</section>
Try this out
<style>
#intromessage{
display: flex;
flex-direction: column-reverse;
}
</style>
A few options are avalaible.
transform:scale(x) can be used
#intromessage,
#intromessage>* {
transform: scale(1, -1); /* value to add/remove via mediaquerie */
}
img {
display: block;
width: 50%;
margin:auto;
}
<header id="titleHeader">
<h1><span id="boot">Example</span>Text</h1>
<a class="navbutton" href="#navbar">Menu</a>
</header>
<section id="intromessage">
<img alt="shoes" src="https://cdn11.bigcommerce.com/s-h8hjw/products/927/images/735/WBHQ19-Retail-Product-OnWhite-Boots-M-1500x1425__00368.1599677007.475.500.png?c=2">
<div>
<h2>Example Text</h2>
<p>
example text, example text, example text<span> example text </span>example text
<span>example text</span>
</p>
</div>
</section>
for older browser, display:table could be involved :
#intromessage {
display: table;
width: 100%
}
#intromessage>div {
display: table-header-group;/* value to add/remove via mediaquerie */
}
img {
display: block;
width: 50%;
margin: auto;
}
<header id="titleHeader">
<h1><span id="boot">Example</span>Text</h1>
<a class="navbutton" href="#navbar">Menu</a>
</header>
<section id="intromessage">
<img alt="shoes" src="https://cdn11.bigcommerce.com/s-h8hjw/products/927/images/735/WBHQ19-Retail-Product-OnWhite-Boots-M-1500x1425__00368.1599677007.475.500.png?c=2">
<div>
<h2>Example Text</h2>
<p>
example text, example text, example text<span> example text </span>example text
<span>example text</span>
</p>
</div>
</section>
flex is already answered but order can be used too :
#intromessage {
display: flex;
flex-wrap:wrap;/* to be different from other answer */
}
#intromessage>div {
width: 100%;
}
img {
display: block;
width: 50%;
margin: auto;
order: 1;/* value to add/remove via mediaquerie */
}
<header id="titleHeader">
<h1><span id="boot">Example</span>Text</h1>
<a class="navbutton" href="#navbar">Menu</a>
</header>
<section id="intromessage">
<img alt="shoes" src="https://cdn11.bigcommerce.com/s-h8hjw/products/927/images/735/WBHQ19-Retail-Product-OnWhite-Boots-M-1500x1425__00368.1599677007.475.500.png?c=2">
<div>
<h2>Example Text</h2>
<p>
example text, example text, example text<span> example text </span>example text
<span>example text</span>
</p>
</div>
</section>
and the latest : grid can use order too
#intromessage {
display: grid;
grid-template-rows: auto;
}
img {
display: block;
width: 50%;
margin: auto;
order: 1;/* value to add/remove via mediaquerie */
}
<header id="titleHeader">
<h1><span id="boot">Example</span>Text</h1>
<a class="navbutton" href="#navbar">Menu</a>
</header>
<section id="intromessage">
<img alt="shoes" src="https://cdn11.bigcommerce.com/s-h8hjw/products/927/images/735/WBHQ19-Retail-Product-OnWhite-Boots-M-1500x1425__00368.1599677007.475.500.png?c=2">
<div>
<h2>Example Text</h2>
<p>
example text, example text, example text<span> example text </span>example text
<span>example text</span>
</p>
</div>
</section>
I would use flexbox for a responsive layout.
#intromessage {
display: flex;
flex-direction: column-reverse;
}
Here is a good resource: CSS Tricks - Guide to Flexbox
this is my code in two ways in (li)s and yet neither are working:
<ul class="submenuItems">
<li>Our Purpose</li>
<li>Scope</li>
and for the target this is the code :
<h1 id="ourpurpose">Our Purpose<h1>
...
<h1 id="scope">Scope</h1>
i want to link it knowing that both are in the same <section> in a parallax page but separated by images and divs.
Using #scope and #ourpurpose is right, in this case you need to add section (You can also can use div)
body, html {
width: 100%;
height: 100%;
margin: 0;
}
section {
width: 100%;
height: 100%;
background: red;
}
.topics {
background: blue;
color: white;
}
<ul class="submenuItems">
<li>Our Purpose</li>
<li>Scope</li>
</ul>
<section id="ourpurpose-section">
<h2>ourpurpose</h2>
<div class="topics" id="ourpurpose"> I am topics</div>
<p>Some Text</p>
<div class="images"><!-- Some images --></div>
</section>
<section id="scope-section">
<h2>scope</h2>
<div class="topics" id="scope">topics</div>
<p>Some Text</p>
<div class="images"><!-- Some images --></div>
</section>
<section></section>
You need to use ID "ourpurpose" in the href field of link. If the contents are on the same page.
Our Purpose
I am trying to have the 3 unordered list items take up the whole block spaced out evenly, with the 1st one at the start the 2nd one in the middle and the last one touching the end of the block.
I am trying to do it with flex box but currently I am having difficulty, I figured justify-content: would work for this task, but its not doing anything.
Here is the end result I am trying to achieve:
link to codepen
Example:
body {
background: green;
}
.area--third-amenities--list {
width: 375px;
background: blue;
}
ul {
padding: 0;
list-style-type: none;
margin: 0;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
ul li {}
<div class="area--third-amenities--list">
<ul>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
</ul>
</div>
you could use flex-basis:33.33% on the lis so they stay 3 on one line and text-align:center
body {
background: green;
}
.area--third-amenities--list {
width: 375px;
background: blue;
}
ul {
padding: 0;
list-style-type: none;
margin: 0;
display: flex;
flex-wrap: wrap;
text-align:center;
}
ul li {
flex-basis: 33.33%;
}
<div class="area--third-amenities--list">
<ul>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
<li>
<img src="http://i.imgur.com/PwKgUnO.png" />
<p>
50px
</p>
</li>
</ul>
</div>
let me know if this helps
You can use text-align: center on the li..
li
flex: 1 1 100px
text-align: center
http://codepen.io/anon/pen/bqJKwK
I am new to html coding and I could not find exact and clear solution for my problem.
I want to create a page with this format: I want to do the page with list of html.
Here is my html code:
Although I made alignment center my picture is on the left side of the page. What is wrong or missing with my code?
There is no float: center. Only float: left and float: right. You can left-float all of <p> inside the <li> and set the width of them to 33.33%.
In this case the image has to be responsive:
img {
height: auto;
max-width: 100%;
}
Every <li> represent a row
<ul>
<li>
<p>text</p>
<p><img src=""></p>
<p>text</p>
</li>
</ul>
In total
img {
width: 100%;
height: auto;
}
ul {
list-style-type: none;
}
ul>li>* {
box-sizing: border-box;
display: block;
float: left;
word-break: break-all;
padding: 0 5px;
width: 33.333%;
}
.text-center {
text-align: center;
}
.full-width {
width: 100%;
}
<ul>
<li>
<p>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</p>
<p class="text-center">
<img src="http://placehold.it/300x200" alt="">
</p>
<p>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</p>
</li>
<li>
</li>
<li>
<p class="full-width">
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</p>
</li>
<li>
<p class="full-width">
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</p>
</li>
<li>
<li>
<p>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</p>
<p class="text-center">
<img src="http://placehold.it/300x200" alt="">
</p>
<p>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</p>
</li>
</ul>
You would probably be best looking into using a grid system. I would recommend using Twitter's Bootstrap - definitely the best as easiest to start using
http://getbootstrap.com/
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>