CSS Adjustment of HTML Elements - php

I need help with adjusting a certain html element <div class="content"> with css so that it will be fixed and responsive like this (https://i.imgur.com/vYsIUXy.jpg) on that position regardless of screen dimensions and not like this (https://i.imgur.com/qUHHI0q.jpg).
I change the width of #info #head>.content from 100% to 82% but on a smaller screen dimension it overlaps with the cover image.
HTML Code
Snippet
<div id="head">
<div class="content">
<div class="uigrid">
<div class="contingo">
<p style="font-size:30px;">Meng Qi Shi Shen</p>
<div class="horizontal-list">
Adventure
Comedy
Drama
Historical
Romance
Shoujo
<div class="type"><span class="sub" onclick="if (!window.__cfRLUnblockHandlers) return false; changegrid()">Sub</span><span class="dub" onclick="if (!window.__cfRLUnblockHandlers) return false; changegrid()">Dub</span></div> </div>
</div>
</div>
</div>
<div class="overlay"></div>
</div>
Full php(html) code
https://codeshare.io/arj6eA
CSS Code
https://codeshare.io/GbyP86

you can try to use max-width of device to adjust the with you want. Like for instance if the decive is width is 600ps
#media (max-width: 600px) {
#info #head:after {
content: '';
position: absolute;
bottom: 0;
width: 82%;
height: 3px;
box-shadow: 0 2px #1b1c1d;
}
}
or like this one when the width of the device is 1000px
#media (max-width: 1000px) {
#info #head:after {
content: '';
position: absolute;
bottom: 0;
width: 75%;
height: 3px;
box-shadow: 0 2px #1b1c1d;
}
}
for more of this please check here https://www.w3schools.com/css/css_templates.asp

Related

Full Screen Background Image - Wordpress

I have a 1 page site with full screen scrolling sections.
Each section displays correctly on desktop, but on mobile the 'team' section has a white block top and bottom.
I have made another section for teams ('team2test') for use only on mobile - with HTML to try to make the section full height but the background image is not full screen
Please assist in either why the 'team' section has a gap top and bottom - or why my background image is not full screen in 'team2test'
Code for 'team2Test':
body,
html {
height: 100%;
margin: 0;
}
.team-images-mobile {
display: block;
margin-left: auto;
margin-right: auto;
padding: 10px;
width: 200px;
height: 200px;
}
.team-section {
background-image: url(https://neuefund.com/wp-content/uploads/2022/01/team_7693a7d4f435b52cec2b4ce8cbbf00a4.png);
background-position: center;
background-size: cover;
background-repeat: no-repeat;
height: 100vh;
width: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
position: relative;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="team-section">
<div class="team-images-mobile">
<img src="https://neuefund.com/wp-content/uploads/2022/01/MAX-300x300.png" alt="" >
<img src="https://neuefund.com/wp-content/uploads/2022/01/KRISH-300x300.png" alt="">
<img src="https://neuefund.com/wp-content/uploads/2022/01/COFIELD-300x300.png" alt="">
</div>
</div>
Link to site
Your problem comes from:
why the 'team' section has a gap top and bottom
That comes from your padding in
.team-images-mobile {
padding: 10px;
}
why my background image is not full screen
This come from the height: 100vh you set in .team-section
body,
html {
height: 100%;
margin: 0;
}
.team-images-mobile {
display: block;
margin-left: auto;
margin-right: auto;
width: 200px;
}
.team-section {
background-image: url(https://neuefund.com/wp-content/uploads/2022/01/team_7693a7d4f435b52cec2b4ce8cbbf00a4.png);
background-position: center;
background-size: cover;
background-repeat: no-repeat;
width: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.team-section img {
width: inherit;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="team-section">
<div class="team-images-mobile">
<img src="https://neuefund.com/wp-content/uploads/2022/01/MAX-300x300.png" alt="" >
<img src="https://neuefund.com/wp-content/uploads/2022/01/KRISH-300x300.png" alt="">
<img src="https://neuefund.com/wp-content/uploads/2022/01/COFIELD-300x300.png" alt="">
</div>
</div>
The HTML of your "Team section" looks like this now:
<div class="grve-column wpb_column grve-column-1">
<div class="grve-column-wrapper">
<div class="grve-element grve-text">
<h2 style="text-align: center;">Team</h2>
</div>
<div class="wpb_raw_code wpb_content_element wpb_raw_html">
<div class="wpb_wrapper">
<div class="team-section">
<div class="team-images-mobile">
...
</div>
</div>
</div>
</div>
<div class="grve-empty-space grve-height-1x" style=""></div>
</div>
</div>
If you check in your browser inspector, you'd find that the .grve-element (the heading text "Team") is taking up space before the actual .team-section in your code. And that element has a white background.
So it doesn't really matter with your .team-section style. It's more of an HTML structure issue.
There are 2 direction to solve this:
If you can control the overall HTML, simply move your .team-section background css settings to the .grve-column level; or
Make .grve-element height 0 by setting it as "position: absolute; width: 100%;". You'd need to give .team-images-mobile some padding so they won't overlap with "Team".

CSS - hiding the overflow of an image isn't working

I have a problem with my website banner. When I view my banner image on a phone screen, the text on the banner is too small to see. Due to this, I made the width of my image 120% (on CSS) so the text would be larger on a phone screen. When I did this, the banner just extended longer than the website length - but I want the excess banner to be cut off. I tried to solve this by using 'overflow: hidden' but it didn't work. Ultimately, I just want to crop the excess length off my banner but I don't know how.
HTML:
<div class="content">
<div class="banner">
<img src="images/large_banner.png" width="1440" height="80" alt="Sister banner"/>
</div>
</div>
CSS:
#media only screen and (max-width: 550px){
.banner{
height: auto;
width: 120%;
overflow: hidden;
}
}
You put width to the wrong place. You should paste height and width for image and put overflow: hidden; to div .banner.
Here's an example
img{
width:100%;
}
#media only screen and (max-width: 480px){
.content{
width:360px;
margin:0 auto;
}
.banner{
width:90%;
margin: 0 auto;
overflow: hidden;
}
.banner img{
width: 250%;
margin-left:-138px;
}
}
<div class="content">
<div class="banner">
<img src="http://man-centr.uz/image/cache/catalog/slider/slider2-1920x641.jpg" alt="Sister banner"/>
</div>
</div>

How do a make an image zoomed in and not stretched when the screen is too large?

I am using bootstrap 4 inside my wordpress theme. I am trying to make a slide show on the top of my page but the images are stretching out when the size is not 100%.
How do I make the images zoom instead of stretching. I have tried applying
.cover {
background-position: center center !important;
background-repeat: no-repeat !important;
background-attachment: fixed !important;
background-size: cover;
}
class to my tag.
This is the code for where I want to add the image.
<div class="carousel-inner">
<div class="carousel-item active">
<img class='cover' src="<?php echo get_theme_file_uri('/incl/1.jpg');?>">
<div class="carousel-caption">
<h3>Voorbeeld 1</h3>
<p>Voorbeeld beskrywing</p>
</div>
</div>
<div class="carousel-item">
<img class='cover' src="<?php echo get_theme_file_uri('/incl/2.jpg');?>" >
<div class="carousel-caption">
<h3>Voorbeeld 2</h3>
<p>Voorbeeld beskrywing</p>
</div>
</div>
<div class="carousel-item">
<img class='cover' src="<?php echo get_theme_file_uri('/incl/3.jpg');?>">
<div class="carousel-caption">
<h3>Voorbeeld 3</h3>
<p>Voorbeeld beskrywing.</p>
</div>
</div>
</div>
You're expecting image source (src) to be treated as background-image.
Might be !important to you, but it won't happen.
You probably want to show the image as background of parent (I moved cover class on parent):
.cover {
background: transparent no-repeat fixed center /cover;
}
.cover img {
opacity: 0;
display: block;
width: 100%;
height: auto;
}
<div class="cover" style="background-image: url(https://loremflickr.com/620/240)">
<img src="https://loremflickr.com/620/240">
<div class="caption">
<h1>Caption stuff here...</h1>
</div>
</div>
.cover {
background: transparent no-repeat fixed center /cover;
}
.cover img {
opacity: 0;
display: block;
width: 100%;
height: auto;
}
/* You don't need anything below this point. Just for SO example */
body {
margin: 0;
}
.cover {
position: relative;
}
.cover .caption{
width: calc(100% - 60px);
height: calc(100% - 60px);
left: 30px;
top: 30px;
background-color: #42424242;
color: white;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
border: 1px solid #ffffff35;
box-shadow: 0 5px 6px -3px rgba(0,0,0,.1), 0 9px 12px 1px rgba(0,0,0,.07), 0 3px 16px 2px rgba(0,0,0,.06)
}
<div class="cover" style="background-image: url(https://loremflickr.com/620/240)">
<img src="https://loremflickr.com/620/240">
<div class="caption">
<h1>Caption stuff here...</h1>
</div>
</div>
This lets the <img> still set the height of the slide but won't show it, so the background can be viewed. Obviously, you need to do it for each of the items.

automatic (not hover) css overlay depending on database field content

I want to make the following bootstrap code automatically show an overlay for two out of three options contained in a database field. They are SOLD, CONTRACT, and NO.
I want different overlays for SOLD and CONTRACT, and no overlay for NO
I have searched for overlays, most tutorials have on hover events, and I am lost as to how to do this.
<div class="row">
<div class="col-md-6 col-md-offset-3">
<a href="listing_show.php?ID=<?php echo($Recordset1->getColumnVal("ID")); ?>">
<img src="images/<?php echo($Recordset1->getColumnVal("IMAGE")); ?>" class="img-responsive center-block sold" alt="<?php echo($Recordset1->getColumnVal("TITLE")); ?>"/>
</a>
</div><br><br>
</div>
I worked it out through a couple of js fiddles on other questions here, if it helps anyone here is the code I added...
html
I added a thumbnail div and a caption div underneath the image both conditional on the contents of the database field.
<?php if($Recordset1->getColumnVal("SOLD") == "YES") { ?>
<div class="caption post-content-sold"></div>
<? } ?>
<?php if($Recordset1->getColumnVal("SOLD") == "CON") { ?>
<div class="caption post-content-contract"></div>
<? } ?>
Then in the CSS I added code to make the thumbnail relative, and then added the two classes to style the image relating to the database field
.thumbnail {
position: relative;
}
.post-content-sold {
background: rgba(255, 255, 255, 0.8) none repeat scroll 0 0;
opacity: 0.8;
top:0;
left:0;
min-width: 100%;
max-height: 98%;
position: absolute;
color: #ffffff;
content:url(http://www.mtnlakerealty.com/sold.png);
}
.post-content-contract {
background: rgba(255, 255, 0, 1) none repeat scroll 0 0;
opacity: 1;
top:5%;
left:5%;
max-width: 50%;
max-height: 50%;
position: absolute;
color: #ffffff;
content:url(http://www.mtnlakerealty.com/contract.png);
}

How to position a picture flyout

So i have this problem. I want to center my flyout but here is the catch. I do not know what the size of the picture will be since it is a picture uploaded by a user. I also don't what the picture disappearing if i make the screen smaller. I tried to set position to be relative but then it pushes my images / texts behind the flyout down.
<div id="imageFlyout<?=$step['order']+1?>" class="popUpWrapper" style="display:none;position:absolute;top:100px;left:<script type="text/JavaScript">
int w = screen.width;
<?php $tempSize=getimagesize("guidebook_images/".$step['attachment']); if($tempSize[0] > 935){?>w/2<?php }else{?>w-<?php echo($tempSize[0]/2);}?></script>px;">
Centering in HTML is an easy two step process:
Give the parent:
text-align:center;
Give the element:
margin:auto;
Demo: http://jsfiddle.net/uriahjamesgd_73/kNFGj/22/
I used the CSS values VW (viewer width) & VH (viewer height) to specify that the flyout be a percentage of whatever the viewport is at a given instance. Hopefully this allows resizing of the viewport in mobile devices.
<!-- HTML -->
<div class="wrap">
<div class="product">
<span class="flyOut"></span>
</div>
</div>​
/* CSS */
body { margin: 50px; }
.wrap { position: relative; }
.product { background-color: #555; position: relative; width: 100px; height: 75px; }
span.flyOut { display: none; background-color: #ddd; position: absolute; width: 50vw; height: 37.5vh; left: 100%; }
.product:hover > span.flyOut { display: inline-block; }
​

Categories