I have some images:
<div class="builder-item-content row">
<div class="twelve columns b0">
<ul class="upcoming-events">
<li>
<a href="http://www.padi.com/scuba/" target="_blank">
<img src="assets/images/padi_logo.png" alt="" style="text-align:center">
</a>
</li>
<li>
<a href="http://www.sssnetwork.com/" target="_blank">
<img src="assets/images/sss_logo.png" alt="">
</a>
</li>
<li>
<a href="http://www.scubapro.com/" target="_blank">
<img src="assets/images/scubapro02.png" alt="">
</a>
</li>
</ul>
</div>
I want to center them inside the container. How I can do this?
Without really testing this I think after class you have
<ul class="upcoming-events" style="Width:800px; Margin:0 auto;">
This should work with the div as well. Width can be whatever you would want it to be... I just put 800px. The important part is margin:0 auto;
div.builder-item-content.row {
text-align: center;
}
Since images are inline-level, they can be centered with text-align (even tho they aren't text).
Related
so my problem is that i have 3 images with uneven width and still make them intact until it hit a certain width let's say 767px. and when it hit that width each of the images will take a full width of 767px until xs size of screen. sorry if this sentence construction make you crazy.
here's a piece
<div class= "about-content">
<ul>
<li><a href="">
<div class = "inner-content">
<img src="img/about/1.jpg" class="img-fluid">
</div>
</a></li><li><a href="">
<div class = "inner-content">
<img src="img/about/2.jpg" class="img-fluid">
<div class = "overlay-content">
<h4>Book a Test Drive <i class = "fa fa-chevron-circle-right"></i></h4>
</div>
</div>
</a></li><li><img src="img/about/3.jpg" class="img-fluid"></li>
</ul>
<ul>
<li><a href=""><img src="img/about/4.jpg">
</a></li><li><a href=""><img src="img/about/5.jpg">
</a></li><li><img src="img/about/6.jpg"></li>
</ul>
</div>
The images will expand if you use vw (viewport width) measurement. Set a calculation to compensate for their starting positioning as in width: calc(100vw - 70px)
Here's a snippet:
img {
width: 200px;
height: 50px;
}
#media screen and (min-width: 767px) {
img {
width: calc(100vw - 70px);
}
}
<div class="about-content">
<ul>
<li>
<a href="">
<div class="inner-content">
<img src="img/about/1.jpg" class="img-fluid">
</div>
</a>
</li>
<li>
<a href="">
<div class="inner-content">
<img src="img/about/2.jpg" class="img-fluid">
<div class="overlay-content">
<h4>Book a Test Drive <i class="fa fa-chevron-circle-right"></i></h4>
</div>
</div>
</a>
</li>
<li>
<img src="img/about/3.jpg" class="img-fluid">
</li>
</ul>
<ul>
<li>
<a href=""><img src="img/about/4.jpg">
</a>
</li>
<li>
<a href=""><img src="img/about/5.jpg">
</a>
</li>
<li>
<img src="img/about/6.jpg">
</li>
</ul>
</div>
A way to globally give all images a responsive width is to just write this in your css file or inline style in the body tag:
<body style="img{width:100%;height:auto;}">
other way in the css file is:
img
{
width: 100%;
height: auto;
}
You can also change the % to lower as well just play around with the percent until u get it how you need it.
Ideally you should also read about #media queries
I am trying to create a footer with 2 Images who link to a page.
The two links / Images shall stay on the right side of the footer.
The Images shall stand next to each other with a Little margin.
How to I manage this with css?
<footer>
<a href="http://www.google.de/" target="_blank">
<img src="test.jpg" alt="logo.jpg">
</a>
<a href="http://www.google.de" target="_blank">
<img src="test.jpg" alt="logo.jpg">
</a>
</footer>
Wrap them in a div and float it.
CSS:
.images-container {
float: right;
}
.images-container a {
margin-left: 5px;
}
HTML:
<footer>
<div class="images-container">
<a href="http://www.google.de/" target="_blank">
<img src="test.jpg" alt="logo.jpg">
</a>
<a href="http://www.google.de" target="_blank">
<img src="test.jpg" alt="logo.jpg">
</a>
</div>
</footer>
hi if you are using bootstrap framework try this code
html
<footer class="clearfix">
<ul class="links pull-right">
<li> <a href="http://www.google.de/" target="_blank">
<img src="test.jpg" alt="logo.jpg">
</a>
</li>
<li>
<a href="http://www.google.de" target="_blank">
<img src="test.jpg" alt="logo.jpg">
</a>
</li>
</ul>
</footer>
css
.links
{
list-style-type:none;
padding:0;
}
.links li
{
display:inline-block;
}
You can use float:right for your hyperlinks
footer a {
float:right;
}
footer a:first-child {
margin-left: 10px;
}
<footer>
<a href="http://www.google.de/" target="_blank">
<img src="http://placehold.it/50" alt="logo.jpg">
</a>
<a href="http://www.google.de" target="_blank">
<img src="http://placehold.it/50" alt="logo.jpg">
</a>
</footer>
I found many topics but I still have yet to find solution for my issue. When using image src from lorempixel, my code works well but when using image local (4000x3000), it not resizing to fit the div. Hope anyone can help me.
I'm using Bootstrap 3.1.1
HTML
<section class="portfolio">
<div class="portfolio-list">
<ul>
<li>
<div class="portfolio-box">
<a href="#">
<img src="img/thumb-1.jpg" alt="Portfolio item">
</a>
</div>
</li>
<li>
<div class="portfolio-box">
<a href="#">
<img src="http://lorempixel.com/598/386/" alt="Portfolio item">
</a>
</div>
</li>
<li>
<div class="portfolio-box">
<a href="#">
<img src="http://lorempixel.com/598/386/" alt="Portfolio item">
</a>
</div>
</li>
<li>
<div class="portfolio-box">
<a href="#">
<img src="http://lorempixel.com/598/386/" alt="Portfolio item">
</a>
</div>
</li>
<li>
<div class="portfolio-box">
<a href="#">
<img src="http://lorempixel.com/598/386/" alt="Portfolio item">
</a>
</div>
</li>
<li>
<div class="portfolio-box">
<a href="#">
<img src="http://lorempixel.com/598/386/" alt="Portfolio item">
</a>
</div>
</li>
</ul>
</div> <!-- end portfolio-list -->
</section> <!-- end portfolio -->
CSS
.portfolio-list{
background-color: #cccccc;
li{
float: left;
width: 33.33%;
display: block;
}
}
http://jsfiddle.net/2mbsb16m/
You should be setting the images immediate parent elements width and height. Then you can set the image to width:100%: height:auto;
.portfolio-box {
width:300px;
height:300px;
}
.portfolio-box img {
width:100%;
height:auto;
}
Updated fiddle: http://jsfiddle.net/donnellyjoe/2mbsb16m/2/
I am using the plugin Glide.js on my frontpage, and I have build it up almost like shown on the plugin page. This also means that I wish my slider images to have 100% width, but at the same time I want them to be cropped/cut off at the bottom at the window. Precisely like it is don on the plugin page.
My html code looks like this:
<header class='header'>
<div class='header-wrapper'>
<img class='header-logo' src='/assets/glide-logo-cfe0cb95a81b55ff1e872b0c578c527d.png'>
<nav class='header_nav'>
<ul class='header_nav-wrapper'>
<li class='header_nav-item'>
<a class='header_nav-item-a' href='#' id='aboutOpen'>About us</a>
</li>
<li class='header_nav-item'>
<a class='header_nav-item-a' href='#'>Create account</a>
</li>
<li class='header_nav-item'>
<form>
<button class='header_nav-item-a header_nav-item-a--btn header_nav-item-a--donate' src='https://www.paypalobjects.com/en_US/i/btn/'>Login</button>
</form>
</li>
</ul>
</nav>
</img>
</div>
</header>
<div class='slider'>
<div class='slides'>
<div class='slide content_article content_article--fast'>
<center>
<img class='slider-img' src='/assets/bg-fast-219ed63d5978022b88ba2389b4f673b6.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 1</h1>
<p class='content_article-p'>
Sub title 1
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 1
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 1</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/fast-img-3d905c8a57b66ef354467a9a0a07d168.png'>
</div>
</center>
</div>
<div class='slide content_article content_article--simple'>
<center>
<img class='slider-img' src='/assets/bg-responsive-07aefbc31666790f38a6e3e3b46f67a8.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 2</h1>
<p class='content_article-p'>
Sub title 2
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 2
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 2</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/responsive-img-662aaea9b8453dc6eac46064fdcc7a56.png'>
</div>
</center>
</div>
<div class='slide content_article content_article--responsive'>
<center>
<img class='slider-img' src='/assets/bg-simple-2d45eb663c4c69d72f66c19eb0cce285.jpg'>
<div class='content_article-wrapper'>
<h1 class='content_article-h'>Title 3</h1>
<p class='content_article-p'>
Sub title 3
</p>
<div class='content_article-btns'>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>
<span class='entypo-download'></span>
Read more 3
</a>
<a class='content_article-btn header_nav-item-a header_nav-item-a--btn' href='#'>See examples 3</a>
</div>
<img class='content_article-img box-shadow animated fadeOutDownBig' src='/assets/simple-img-af275d5091063498174655c95fa41079.png'>
</div>
</center>
</div>
</div>
</div>
My css is very simple, but only handles the 100% width stretch:
.slider-img {
width: 100%;
}
So how do I cut off my slider images so they fit the height of the screen?
Here is the CSS
.crop{
float:left;
margin:.5em 10px .5em 0;
overflow:hidden; /* this is important */
border:1px solid #ccc;
}
/* input values to crop the image */
.crop img{
margin:-20px -15px -40px -55px;
}
Hello Friends When i Inspect element my Code is so far ...
<div class="ja-megamenu " id="ja-megamenu">
<ul class="megamenu level0">
<li class="mega first active">
<a href="http://127.0.0.1/" class="mega first active" id="menu435" >
<span class="has-image" >
<img src=images/on_home.png>
</span>
</a>
</li>
<li class="mega haschild">
<a href="/index.php?option=com_community&view=frontpage&Itemid=455" class="mega haschild" id="menu455" title="Grower Community">
<span class="has-image" >
<img src=images/active_11.png>
</span>
</a>
<div class="childcontent cols1 ">
<div class="childcontent-inner-wrap">
<div class="childcontent-inner clearfix" style="width: 200px;">
<div class="megacol column1 first" style="width: 200px;">
<ul class="megamenu level1">
<li class="mega first">
<div class="group">
<div class="group-title">
<a href="/index.php?option=com_community&view=photos&Itemid=507" class="mega first" id="menu507" title="Photos">
<span class="has-image" >
<img src=images/wt_under_link_01_01.png>
</span>
</a>
</div>
</div>
</li>
<li class="mega last">
<a href="/index.php?option=com_allvideoshare&view=category&slg=0&orderby=default&Itemid=934" class="mega last" id="menu934" title="Videos">
<span class="has-image" >
<img src=images/wt_under_link_01_02.png>
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</li>
<li class="mega">
<a href="/index.php?option=com_kunena&view=topics&mode=replies&Itemid=506" class="mega" id="menu506" title="Forum">
<span class="has-image" >
<img src=images/active_05.png>
</span>
</a>
</li>
<li class="mega last">
<a href="/index.php?option=com_easyblog&view=blogger&limit=-2&Itemid=944" class="mega last" id="menu944" title="Blog">
<span class="has-image" >
<img src=images/active_07.png>
</span>
</a>
</li>
</ul>
</div>
Now here I want to change the image on hover ...
I am using somehing like this
.ja-megamenu ul.level0 li.mega a.mega span.has-image:hover{
background:url(../../images/act_05.png) no-repeat 0 0;
}
but the image hover is not occurs ... can any one please help me
I think hover is not happens due to span ...
please suggest me what i can do here ?
As it's been said already, the background image will not display as long as you have an image over it, so you could use this to hide the image when hovering the span:
.ja-megamenu ul.level0 li.mega a.mega span.has-image:hover > img {
visibility:hidden;
}
See this jsfiddle
I would recommend applying the :hover pseudo-class to the anchor (a.mega:hover) then changing the child <span> beneath it.
.ja-megamenu ul.level0 li.mega a.mega:hover span.has-image {
/* background change */
}
Keep in mind that as long as there is a child <img> within the span, that's going to overlap whatever you have set a background on the span. That is to say the span's background will never overcome the <img src="..."> in terms of visuals.
It looks like you are trying to change the background image of the span and not the src of the image tag.
In order to do that you would probably have better luck with using jQuery.