do you know how to remove div when it´s inside of another div? I need to remove div "2" and this isn´t working:
#media all and (max-width: 600px)
{
#zmiz { display:none; }
}
<div class="row clearfix">
<div class="fwImage col span_6">
<div class="ahoj" style="position: absolute; width: 80%;">
<div class="col span_4 logo_shift" style="line-height: 21px; ">
<h1>Certifikát</h1>
<p>)ily linde.Yo.</p>
<p>Sc.</p>
<p>St Gic, ad.</p>
</div>
</div>
<div id="gallery-t-group" class="royalSlider rsDefaultInv">
<div id="zmiz">
<a class="rsImg" href="gal/blank.png"><img class="rsTmb" width="56" height="56"src="gal/p.png" /></a>
</div>
<a class="rsImg" href="gal/certifikat1.jpg"><img class="rsTmb" width="56" height="56"src="gal/certifikat2.jpg" /></a>
<a class="rsImg" href="../img/full-width/medium/2.jpg"><img class="rsTmb" width="56" height="56" src="gal/kabel.jpg" /></a>
</div>
</div>
</div>
Thanks
Your id must start with a letter (at least for this CSS problem, even if theoretically in HTML5 it's not mandatory). It works if you fix that :
<div id="a1" class="1_5">
<div id="a2">
<a class="2_5" href="a.png"><img class="3" width="1" height="2" src="b.png" />AAA</a>
</div>
</div>
#media all and (max-width: 600px) {
#a2 {display:none;}
}
http://jsbin.com/ehuker/1/edit
Note that even if now HTML5 ids are supposed to be less constrained, there are still many tools, old browsers, and so on which don't work well if you don't follow the old HTML4 naming rules.
Your code works on fiddle. Also, tidied it up for you:
<div class="row clearfix">
<div class="fwImage col span_6">
<div class="ahoj" style="position: absolute; width: 80%;">
<div class="col span_4 logo_shift" style="line-height: 21px; ">
<h1>Certifikát</h1>
<p>)ily linde.Yo.</p>
<p>Sc.</p>
<p>St Gic, ad.</p>
</div>
</div>
<div id="gallery-t-group" class="royalSlider rsDefaultInv">
<div id="zmiz">
<a class="rsImg" href="gal/blank.png"><img class="rsTmb" width="56" height="56"src="gal/p.png" /></a>
</div>
<a class="rsImg" href="gal/certifikat1.jpg"><img class="rsTmb" width="56" height="56"src="gal/certifikat2.jpg" /></a>
<a class="rsImg" href="../img/full-width/medium/2.jpg"><img class="rsTmb" width="56" height="56" src="gal/kabel.jpg" /></a>
</div>
</div>
</div>
Most likely, what's happening is you're overwriting this display:none; rule somewhere else in your CSS or your JavaScript.
If you post a link to your code, or your full code and full CSS, I will take a look.
Edit: This answer addressed a sample code snippet which had div id="2".
Dystroy's answer is correct: by specification an ID cannot start with a number; but if for some reason you can't change the ID (maybe all your JavaScript is dependent on it or something), this workaround does work:
CSS
---
#media all and (max-width: 600px) {
[id='2'] {
display: none;
}
}
HTML
----
<div id="a1" class="1_5">
<div id="a2">
<a class="2_5" href="a.png"><img class="3" width="1" height="2" src="b.png" />AAA</a>
</div>
</div>
Working demo here (drag the 'result' section wider to see the div appear).
Related
I want to have these 3 gifs in a row, each taking up a third of the width of the page. but when I look at the page, they are tiny. I set the divs to 32% each and the gifs should take up 100% of their div.
this is my code:
<div id="3wizards" width=100% style= "float:center">
<div id="w1" width=32% style="float:left">
<img src="wizard(1).gif" width=100%>
</div>
<div id="w2" width=32% style="float:left">
<img src="wizard(1).gif" width=100%>
</div>
<div id="w3" width=32% style="float:right">
<img src="wizard(1).gif" width=100%>
</div>
</div>
what the page looks like:
Image of the page, the three wizard gifs are tiny.
(I understand that I could just remove the difs, but what if I want to have text in one of the thirds in the future? I'm pretty sure need the difs for that, so I want to get it to work with the divs now so I can use it in the future.)
Hi Anura have a look at the below code.
First, wrap the code with the main wrapper and use the flex to align in the same row.
<div class="gif-wrapper">
<div id="w1" class="gif">
<img src="wizard(1).gif" width=100%>
</div>
<div id="w2" class="gif">
<img src="wizard(1).gif" width=100%>
</div>
<div id="w3" class="gif">
<img src="wizard(1).gif" width=100%>
</div>
</div>
CSS:
.gif-wrapper {
display: flex;
flex-wrap: wrap;
margin: 0 -15px;
}
.gif-wrapper .gif {
width: calc(100% / 3 - 30px);
margin: 0 15px;
}
Use media query for responsive devices
Use flex for fix that:
<div id="3wizards" width=100% style="display: flex;gap:2%;">
<div id="w1" width=32% height=100%>
<img src="https://s4.uupload.ir/files/5c29cf910a706_8m.jpg" width=100%>
</div>
<div id="w2" width=32%>
<img src="https://s4.uupload.ir/files/5c29cf910a706_8m.jpg" width=100%>
</div>
<div id="w3" width=32%>
<img src="https://s4.uupload.ir/files/5c29cf910a706_8m.jpg" width=100%>
</div>
</div>
I've been trying to solve this for almost 6 hours just to get this to be responsive on mobile. Will someone please help me? It's really difficult and I really want to finish this homework.
I wanted it to look like this, but mobile responsive: https://imgur.com/kRcHUDJ
I only use HTML and inline CSS, hopefully, there is a solution to this.
<center>
<div id="home-secondary" style ="display: inline-block";>
<ul id="homepageGuide">
<a href="/blog/"><img class="img-responsive" data-original="/uploads/button-1.png" />
<p><img src="https://cdn.theatlantic.com/assets/media/img/mt/2019/07/GettyImages_138965532/lead_720_405.jpg?mod=1563813032" width="500px" alt="example one"></p>
<span class="color-overlay"></span>
</a></ul>
</div>
<div id="home-secondary" style ="display: inline-block";>
<ul id="homepageGuide">
<a href="/testimonials.php">
<img class="img-responsive" data-original="/uploads/button-2.png" />
<p><img src="https://cdn.theatlantic.com/assets/media/img/mt/2018/11/shutterstock_552503470/lead_720_405.jpg?mod=1541605820" width="500px" alt="example two"></p>
<span class="color-overlay"></span>
</a></ul>
</div>
</center>
Demo here: https://codepen.io/anon/pen/WVpwwX
It does appear to be working great on desktop, what I wanted to achieve is given; but when it comes to mobile, the results aren't great. I had to scroll to the right just to see the full image.
My expected output is to have the images stacked up together when viewed on mobile. Thanks guys.
Almost there. The images need to have a max-width set for mobile devices so they will resize automatically instead of flowing off the screen because of their 500px width setting. Set display to inline-block as well:
https://codepen.io/ZorlacMeister/pen/PMpNRK
You can test easily in Chrome. Hit F12, then click on the little icon that looks like two mobile devices standing upright next to each other, then RELOAD the page to see the mobile layout.
HTML
<center>
<div id="home-secondary" style ="display: inline-block">
<ul id="homepageGuide">
<a href="/blog/"><img data-original="/uploads/button-1.png" />
<p><img class='img-responsive' src="https://cdn.theatlantic.com/assets/media/img/mt/2019/07/GettyImages_138965532/lead_720_405.jpg?mod=1563813032" width="500px" alt="example one"></p>
<span class="color-overlay"></span>
</a></ul>
</div>
<div id="home-secondary" style ="display: inline-block">
<ul id="homepageGuide">
<a href="/testimonials.php">
<img data-original="/uploads/button-2.png" />
<p><img class='img-responsive' src="https://cdn.theatlantic.com/assets/media/img/mt/2018/11/shutterstock_552503470/lead_720_405.jpg?mod=1541605820" width="500px" alt="example two"></p>
<span class="color-overlay"></span>
</a></ul>
</div>
</center>
CSS
.img-responsive {
max-width:75%;
display: inline-block;
}
You can use a grid layout to achieve this.
grid-gap: 1em; specifies your padding between elements
center {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 1em;
}
img {
max-width: 100%;
}
<center>
<div id="home-secondary" style="display: inline-block" ;>
<ul id="homepageGuide">
<a href="/blog/"><img class="img-responsive" data-original="/uploads/button-1.png" />
<p><img src="https://cdn.theatlantic.com/assets/media/img/mt/2019/07/GettyImages_138965532/lead_720_405.jpg?mod=1563813032" width="500px" alt="example one"></p>
<span class="color-overlay"></span>
</a>
</ul>
</div>
<div id="home-secondary" style="display: inline-block" ;>
<ul id="homepageGuide">
<a href="/testimonials.php">
<img class="img-responsive" data-original="/uploads/button-2.png" />
<p><img src="https://cdn.theatlantic.com/assets/media/img/mt/2018/11/shutterstock_552503470/lead_720_405.jpg?mod=1541605820" width="500px" alt="example two"></p>
<span class="color-overlay"></span>
</a>
</ul>
</div>
</center>
I set the image width to 100% and used a class named column on the <ul> to set the box-sizing, float a relative width and display.
I also set the <ul> paddings to 2.5%.
Check it on Codepen or below
.column {
box-sizing: border-box;
float: left;
width: 50%;
display: inline-block;
}
ul{
padding-left: 2.5%;
padding-right: 2.5%;
}
<center>
<ul class="homepageGuide column">
<a href="/blog/"><img class="img-responsive" data-original="/uploads/button-1.png" />
<p>
<img src="https://cdn.theatlantic.com/assets/media/img/mt/2019/07/GettyImages_138965532/lead_720_405.jpg?mod=1563813032" width="100%" alt="example one">
</p>
<span class="color-overlay"></span>
</a>
</ul>
<ul class="homepageGuide column">
<a href="/testimonials.php">
<img class="img-responsive" data-original="/uploads/button-2.png" />
<p>
<img src="https://cdn.theatlantic.com/assets/media/img/mt/2018/11/shutterstock_552503470/lead_720_405.jpg?mod=1541605820" width="100%" alt="example two">
</p>
<span class="color-overlay"></span>
</a>
</ul>
</center>
I am working on a photo gallery(using fancyBox and PHP) for my photography page, and I can't figure out how to make the vertical align for my image gallery to be centered. I currently have placed mock images(from my own gallery) to figure out the layout, and I will then replace them with a PHP query to fill up the gallery with all my content automatically. I have also given each row a (temporary) different color to simply visualize the layout, as well as having a 12 division layout bar at the top for easier handling. The way I currently have my HTML and CSS code set up is as follows:
HTML:
<div class="gallery">
<div class="row row-one">
<div class="col-lg-4">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/burnaby_mountain.jpg'><img class='img-responsive' src='images/photography/thumbs/burnaby_mountain.jpg'></a>
</div>
<div class="col-lg-4">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/lions_gate.jpg'><img class='img-responsive' height="500px" src='images/photography/thumbs/lions_gate.jpg'></a>
</div>
<div class="col-lg-4">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/bubbles.jpg'><img class='img-responsive' src='images/photography/thumbs/bubbles.jpg'></a>
</div>
</div>
</div>
CSS:
.gallery {
display: table;
}
div .row-one {
background-color: red;
display: table-row;
vertical-align: middle;
}
.col-lg-4 {
display: table-cell;
}
As you can see, I have nested the columns inside rows(I did not include the other rows' CSS code, as they're the same except for the background-color attribute, with the intention of automating the gallery later through PHP queries) and rows inside a div container called gallery. From other examples I've seen through looking up for a solution, I've seen people give the main container the display attribute of table, and rows the attribute display: table-row, and lastly the column the table-cell attribute. I have tried this, as well as many other combinations of CSS attributes and have not found a way to center the gallery.
For a better visualization of what I would like to achieve
Thank you for your help, and excuse the lengthy question. I have been searching for a long time and it now feels like something in my code is faulty. I am fairly new to HTML/CSS and although most of my site is working as intended, this is the last bit I need to get it up and running.
Something like this?
.gallery {
display: flex;
height: 30%;
/* flex-direction:column; */
}
.box {
border: 1px solid white;
background: red;
display: flex;
justify-content: center;
flex: 1;
padding: 10px;
}
.inner-box {
align-self: center;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="gallery">
<div class="box">
<div class="inner-box">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/burnaby_mountain.jpg'><img class='img-responsive' src='https://i.kinja-img.com/gawker-media/image/upload/t_original/bhjivrw2chm9um9yrrmy.jpg'></a>
</div>
</div>
<div class="box">
<div class="inner-box">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/lions_gate.jpg'><img class='img-responsive' height="500px" src='https://media.gettyimages.com/photos/cocker-spaniel-puppy-picture-id904219284'></a>
</div>
</div>
<div class="box">
<div class="inner-box">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/bubbles.jpg'><img class='img-responsive' src='http://cdn.bangli.uk/images/201504/article_9323_1.jpg'></a>
</div>
</div>
</div>
<div class="gallery">
<div class="box">
<div class="inner-box">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/burnaby_mountain.jpg'><img class='img-responsive' src='https://i.kinja-img.com/gawker-media/image/upload/t_original/bhjivrw2chm9um9yrrmy.jpg'></a>
</div>
</div>
<div class="box">
<div class="inner-box">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/lions_gate.jpg'><img class='img-responsive' height="500px" src='https://media.gettyimages.com/photos/cocker-spaniel-puppy-picture-id904219284'></a>
</div>
</div>
<div class="box">
<div class="inner-box">
<a data-type='image' data-fancybox=landscape data-caption=caption href='images/photography/fres/bubbles.jpg'><img class='img-responsive' src='http://cdn.bangli.uk/images/201504/article_9323_1.jpg'></a>
</div>
</div>
</div>
I'm using bootstrap grid as shown below and I'm trying to centralize some divs. ( pic). I've tried everything {margin:0 auto; width:50% } etc etc but I can't work it out. It can't be that difficult to centralize some divs. What's the problem here? Please don't mark it as a duplicate. I've been researching the whole day, I just can't work it out.
Thank you
<header data-spy="affix" id="myHeader" class="container row">
<div class="col-sm-4 ">
<div class="centralize">
<a href="http://www.facebook.com" target="_blank">
<img class="logos" src="images/facebook.png" onmouseover="zoomin(this.id)" onmouseout="zoomout(this.id)">
</a>
<a href="http://www.twitter.com" target="_blank">
<img class="logos" src="images/twitter.png" onmouseover="zoomin(this.id)" onmouseout="zoomout(this.id)">
</a>
<a href="http://www.instagram.com" target="_blank">
<img class="logos" src="images/instagram.png" onmouseover="zoomin(this.id)" onmouseout="zoomout(this.id)">
</a>
</div>
</div>
<div class="col-sm-4">
<div class="centralize">
//Other Stuff to be centralized
</div>
</div>
<div class="col-sm-4">
<div class="centralize">
//Other Stuff to be centralized
</div>
</div>
</header>
Actually with {margin:0 auto; width:50%} it should work.
But in your code I see that you are using the .col-sm-4 class on the parent div that only takes 1/3 of the width. It might work with .col-sm-12 instead that takes 100%
To center align the content within the class="centralize" divs, use:
.centralize {
text-align: center;
}
I am trying to render the images, it comes out perfectly in Firefox and Chrome, but is having issues in Safari(v 7.0.3). In Safari, image shifts to bottom right, while I want the image to be at the bottom center.
This is my css
.circular {
/*margin: 10px 30px 0px 30px;*/
display: block;
margin: 0 auto;
position: relative;
bottom:-400px;
left:93%;
transform:translateX(-50%);
}
HTML :
<section class="module parallax parallax-1">
<div class="container">
<div class="circular" vertical-align:middle; text-align:center><img src="images/index/yoyo.png" width=120px height=120px></div>
<div class="social_tags" vertical-align:middle; >
<img src="images/index/github.png" width=40px height=40px>
<img src="images/index/facebook.png" width=40px height=40px>
<a href="mailto:yoyo#gmail.com?Subject=Hello" ><img src="images/index/gmail.png" width=40px height=40px></a>
<img src="images/index/linkedin.png" width=40px height=40px>
</div>
</div>
</section>
You have several issues with your html.
I fixed them in this fiddle and it works the same in chrome as in safari: https://jsfiddle.net/msq0eqch/3/
This is the corrected html code:
(You had your style without style="" etc.)
<section class="module parallax parallax-1">
<div class="container">
<div class="circular" style="vertical-align:middle; text-align:center"><img src="images/index/yoyo.png" width="120px" height="120px"></div>
<div class="social_tags" style="vertical-align:middle;" >
<img src="images/index/github.png" width="40px" height="40px">
<img src="images/index/facebook.png" width="40px" height="40px">
<img src="images/index/linkedin.png" width="40px" height="40px">
</div>
</div>
</section>
Also add -webkit-transform:translateX(-50%); to your css.