CSS, rounded corners not working - php

I have two pictures on top of each other:
Here is the code:
<div class="picture">
<span class="name"><br/>Pavadinimas</span>
<div class="picture-content">
<div class="icons">
<div class="ico-info"><img src="images/product_mark_1.png" />
<span class="ico-info">Automatinis mechanizmas</span>
</div>
<div class="ico-info"><img class="ico-info" src="images/product_mark_2.png" />
<span class="ico-info">Miegamas mechanizmas</span>
</div>
<div class="ico-info"><img src="images/product_mark_3.png" /><br/>
<span class="info">Spyruoklės</span>
</div>
</div>
<div class="picture-grey"><img alt="" src="images/grey.png" />
</div>
</div>
<div class="picture-photo"><img alt="" src="images/pic.png" />
<div class="description1">
Ilgis/Plotis/Aukštis
</div>
<div class="description2">
Ilgis/Plotis
</div>
<div class="description3">
300/300/300
</div>
<div class="description4">
miegamoji dalis 100/100
</div>
</div>
</div>
I want the image at the top to be with rounded corners like this:
My css classes is:
.picture{
position:relative;
width:400px;
height:200px;
float:left;
margin-left:48px;
margin-right:35px;
margin-bottom:90px;
margin-top:10px;
}
.picture-content{
position:absolute;
bottom:0px;
width:360px;
height:211px;
}
.picture-grey{
position:absolute;
bottom:-65px;
left:15px;
height:243px;
width:407px;
float:left;
}
.picture-photo{
position:absolute;
width:380px;
height:223px;
-moz-border-radius: 50px;
-webkit-border-radius: 20px;
-khtml-border-radius: 20px;
border-radius: 20px;
top:0px; left:0px;
}
But unfortunately rounded corners is not working at all! Why not? Is there some issue I don't know?

you want your image round! not DIV!
.picture-photo img {
width:380px;
height:223px;
-moz-border-radius: 50px;
-webkit-border-radius: 20px;
-khtml-border-radius: 20px;
border-radius: 20px;
}

As an alternate answer, as long as the container .picture-photo wraps tight around the image (no visible padding), you can add the following CSS to hide the corners that are sticking out from the child element (the image):
.picture-photo {
overflow:hidden;
}

This is a old problem with firefox (and probably a few other browsers as well); it didn't crop the images until the latest firefox version:
Firefox -moz-border-radius won't crop out image?
Just out of curiosity, can you try the following?:
.picture{
position:relative;
width:462px;
height:305px;
margin:0px;
padding:0px;
background:url('http://i.stack.imgur.com/w0mOg.png') no-repeat;
background-position:50% 50%;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
-khtml-border-radius: 20px;
border-radius: 20px;
}
<div class="picture"></div>
I have the latest version of firefox so I can't check if it works on older versions as well, but it would make sense if it did. Firefox has been able to crop divs for quite some time.

Related

Problem trying to position: fixed on a grid row

Im trying to do that: get 3 consecutives rows of a grid being "fixed;" but Im having problems that idk. Heres my code:
.main-container {
display:grid;
background-color:#e0e0e0;
grid-template-columns: 50% 50%;
box-sizing:border-box;
z-index:-1;
}
.main-container > * {
text-align:center;
display:flex;
justify-content:center;
align-items:center;
}
.main-container div {
color:black;
border: px solid black;
}
.main-container video {
display:block;
width:100%;
height:100%;
/* Scale video to container size */
object-fit: cover;
object-position: center;
z-index:10000;
}
.main-container h4 {
color:#edbd87;
}
.item1{
grid-column: 1 / 3;
background-color: green;
height:1080px;
}
.item2{
right:0;
left:0;
top:300px;
bottom:0;
position:absolute;
grid-column: 1 / 3;
display:inline-block;
z-index:1000000;
}
.item3{
background:#e0e0e0;
grid-column: 1 / 3;
height:40vh;
border-bottom:1px solid black;
}
.item4 {
padding:30px;
z-index:10;
width:100%;
height:800px;
}
.item4 img{
padding:15px;
justify-self:center;
display:block;
width:90%;
height:80%;
/* Scale video to container size */
object-fit: cover;
object-position: center;
border-radius: 80px 20px;
z-index:10;
}
.item5{
padding:40px;
width:100%;
display: inline;
z-index:9;
}
.item5 *{
padding:20px;
font-weight:bold;
font-size: 300%;
}
.item5 p{
margin-top:30px;
padding:40px;
font-weight:bold;
font-size: 180%;
}
.item5 h4{
margin-top:40px;
font-weight:bold;
font-size: 640%;
}
<?php get_header(); ?>
<div class="main-container">
<div class="item1">
<video id="vid" src="http://localhost/wordpress/wp-content/themes/twentytwentyone-child/img/coffee1.mp4" width="1920" height="1080" autoplay loop muted type="video/mp4"> </video>
</div>
<div class="item2">
<p style="font-size:50px; color:white;"> Join Us! </P>
<button type="button" class="btn btn-outline-warning" style="font-family:forum; font-weight:bold; background-color:transparent; border-radius: 3px; color:yellow; font-size:50px; border: 2px solid yellow;">Warning</button>
</div>
<div class="item3">
<img src="http://localhost/wordpress/wp-content/themes/twentytwentyone-child/img/logo.png" />
</div>
<div class="item4">
<img src="http://localhost/wordpress/wp-content/themes/twentytwentyone-child/img/arvan2.jpg" />
</div>
<div class="item5">
<h4>WHO WE ARE?</h4>
<p>
ArvanJobs is above all peace of mind. It is a new way
of working, of traveling, of training, of advancing in
your career. Whether you are a company looking for
workers or you are looking for a new job
opportunity, ArvanJobs will always be by your side,
selecting the best workers and the best companies
that will boost your career.
</p>
</div>
<div class="item6">
<h4>WHY WORK WITH US?</h4>
<p>
For our personal treatment, our advice, and above
all for our experience working in hotels in
numerous countries.
Because we know how difficult it is to take that step
of daring to work in a foreign country. Because we
know how hard it is to find the right staff.
</p>
</div>
<div class="item7">
<img src="http://localhost/wordpress/wp-content/themes/twentytwentyone-child/img/arvan4.jpg">
</div>
<div class="item8">
<h4>HOW WE WORK?</h4>
<p>
All candidates are interviewed by staff who have
worked in hotels, not offices
The same happens with our clients who have to
satisfy a series of criteria and guarantees for the
worker to work with us.</p>
</div>
<div class="item9">9</div>
<div class="item10">10</div>
</div>
<?php get_footer(); ?>
I want to fix .item4 and .item5 (they are in a row with 2 columns) and triplicate the row to be the same (with diff content) 3 times. And I want all of the 3 rows being fix.
The problem is when i put the position fixed in any of the .items the thing goes crazy.
I upload a image to clarify myself, sry about:
There u can see the 3 rows, I want the 3 rows being fixed, or at least the images being fixed for when I scroll down, the 2nd row will cover the 1st, and then the 3rd will cover the 2nd. I like this "diapositive" effect.
I tried some solutions, you can use this one:
when I position the element in the grid to fix, I make a new empty element with the same width and height, and the problem is solved.

Wordpress - CSS styling not applying on a row

I'm currently building a site on Wordpress using the html5blank as the parent theme. I've built all the front-end text pages on HTMl/CSS. When I've transferred all the files over a lot of the styling has broken - I've fixed the majority of it but there's one section that I cannot fix. This is how it should look -
And this is how it looks in the Wordpress site -
When I've inspected the site via developer tools it seems as though these rules are not being applied -
.agencyproducts {
position: relative;
display: inline-block;
text-align: center;
}
Also, the row in the front-end site is applying a height rule but not in the wordpress site. I've looked at applying specificity rules and !important but nothing (this also disrupts other styling rules on other parts of the site). I'm really stuck on this and would appreciate any assistance.
Here's the full code for the section -
section#products {
height: 800px;
max-width: 100%
}
.agencyproducts {
position: relative;
display: inline-block;
text-align: center;
}
.agencyproducts p {
text-align: center;
margin: 30px;
}
.agencyproducts img {
width: 70px;
height: 70px;
position: relative;
line-height: 1;
top: 50%;
}
figure {
text-align: center;
display: inline-block;
max-width: 80px;
height: 100px;
vertical-align: top;
margin: 5px;
font-size: 9px;
margin-bottom: 60px;
}
figure img {
padding-bottom: 5px;
}
.four {
padding: 0;
margin: 0;
border: 0;
}
.images {
margin-top: 30px;
border-bottom: 10px;
}
.images img {
margin-left: 20px;
padding: 10px;
}
.chevron {
height: 150px;
}
.chevron figcaption {
margin-top: 20px;
font-size: 13px;
color: #d3d3d3;
}
hr.hragency {
display: block;
width: 250px;
margin-top: 0em;
margin-bottom: 0em;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 1px;
border-color: #F0F0F0;
}
<section id="products">
<div class="container">
<div class="row">
<div class="twelve columns agencyproducts">
<p>WHAT PRODUCT ARE YOU INTERESTED IN?</p>
<a href="2k4kproduction.html">
<figure>
<img src="images/production.png" alt="Production">
<figcaption>2K / 4K PRODUCTION</figcaption>
</figure>
</a>
<a href="postproduction.html">
<figure>
<img src="images/post-production.png" alt="Post-Production">
<figcaption>POST PRODUCTION</figcaption>
</figure>
</a>
<a href="2d3danimation.html">
<figure>
<img src="images/animation.png" alt="Animation">
<figcaption>2D / 3D ANIMATION</figcaption>
</figure>
</a>
<a href="adhoc.html"><figure>
<img src="images/ADHOC.png" alt="ADHOC">
<figcaption>ADHOC</figcaption>
</figure>
</a>
<a href="interactive.html">
<figure>
<img src="images/interactive.png" alt="Interactive">
<figcaption>INTERACTIVE & PERSONALISED</figcaption>
</figure>
</a>
<a href="tvadverts.html">
<figure>
<img src="images/tv-adverts.png" alt="TV ADVERTS">
<figcaption>TV ADVERTS</figcaption>
</figure>
</a>
<a href="360video.html"><figure>
<img src="images/360.png" alt="360 Video and VR">
<figcaption>360 VIDEO & VIRTUAL REALITY</figcaption>
</figure>
</a>
</div>
</div>
<hr class="hragency">
<div class="row">
<div class="images">
<div class="four columns">
<img src="images/VIDEO.jpg" alt="Video">
<img src="images/blog.jpg" alt="blog">
</div>
<div class="four columns">
<img src="images/faq.jpg" alt="FAQ">
<img src="images/VIDEO.jpg" alt="Video">
</div>
<div class="four columns">
<img src="images/blog.jpg" alt="blog">
<img src="images/faq.jpg" alt="FAQ">
</div>
</div>
</div>
</div>
</section>
<section class="chevron">
<div class="container">
<div class="row">
<figure>
<figcaption>SEE MORE</figcaption>
<i class="fa fa-chevron-circle-down fa-3x" aria-hidden="true"></i>
</figure>
</div>
</div>
</section>
Try this:
.agencyproducts{
width:100%;
text-align:center;
}
.agencyproducts a{
display:inline-block;
}
Because container .agencyproducts need to have text-align:center and first childs of it must be displayed as inline-block ... then they will display properly. You only set child of a tag as display:inline-block but do not tell CSS how it should treat it parent.
With what I understood try appending !important to your custom css properties so as to override any pre-existing style properties.
height: 150px !important;

CSS/HTML Gap Issue

Ok, so when I see my div on my site and whenever I load it up there is always a someone significantly noticeable gap between the text and space above the text. I dont know if somethings wrong with my CSS and I have no clue how to fix this...
Here is a screenshot and code -
Thank you :-)
#box2
{
overflow:auto;
border: 10px solid #a1a1a1;
padding: 95px; 40px;
width: 180px;
height: 5px;
border-radius: 25px;
margin-left:auto;
margin-right:0;
}
HERE IS SOME HTML
<!---Bad Rats--->
<img src="" width="450" height="200" align="left"></img>
<div id="box2">
<div id="reviewtext">
</div>
</div>
I guess the problem is in the invalid CSS making padding from all sides 95px:
padding: 95px; 40px;
Make it look something like:
padding: 0 40px;
JSFiddle

HTML elements are contained to each other

I have a problem with some HTML elements. I have an image and a title in a <header> tag - they should both move independently to each other, however when I move the img element down 40px with the margin-top attribute - the title seems to move down 40px with it. So I add margin-top: -20px; to move it back up and it seems to stay put.
Here's my code:
The header file:
<div class="page">
<header>
<div class="titlesec">
<img class="circular" src="themes/default/image.jpg" />
<a class="logo" href="<?php echo base_url(); ?>">
<?php echo site_name(); ?>
</a>
</div>
<div class="split"></div>
</header>
The footer file:
<footer>
<p>© Copyright <?php date("Y"); ?> Duncan Hill</p>
</footer>
</div>
</body>
</html>
and my css:
.page {
width: 80%;
margin-left: 10%;
margin-right: 10%;
}
.logo {
font-family: 'Helvetica Neue';
font-weight: 100;
font-size: 56px;
text-decoration: none;
color: #555555;
margin-top: -20px;
}
.split {
height: 1px;
background-color: #CCCCCC;
}
.circular {
margin-top: 40px;
width: 80px;
height: 80px;
border-radius: 150px;
-webkit-border-radius: 150px;
-moz-border-radius: 150px;
}
.titlesec {
height: 150px;
}
Any help is appreciated immensely!
img and a are inline tags. Which means they are in the same line. Adding margin-top manipulates this line, and affects therefore both of them.
Depending on what you want to do, you could solve this with surounding both elements with their own div. Then you can style the divs independently. Maybe a float on those divs comes in handy, too.
Close your "page" DIV. It seems that your not properly closing your html tags.

CSS: margin issues

I'm trying to output multiple elements in a single class, but i'm having trouble separating the top of page from the actual elements.
I've tried separating each image with div.element img:not(:nth-of-type(1)){ and div.element img:nth-of-type(1){ that didn't work. How would I manipulate the space between the first element, but not the others?
<div class="element">
<img src="http://website.com">
</div>
<div class="element">
<div id="Projecttitle" class="Projecttitle">Test Title</div>
</div>
<div class="element">
<div id="Projectdescription" class="Projectdescription">Test description</div>
</div>
<div class="element">
<img src="http://website.com">
</div>
<div class="element">
<div id="Projecttitle" class="Projecttitle">Test Title</div>
</div>
<div class="element">
<div id="Projectdescription" class="Projectdescription">Test description</div>
</div>
div.element:first-child {
padding-top: 0;
}
div.element {
padding-top: 10px;
}
Your HTML doesn't make sense. If you keep elements that logically belong together, you get semantic code that's much easier to style, like so:
<div class="project">
<div class="image">
<img src="#" alt="image">
</div>
<div class="text">
<h1>Test Title</h1>
<p>Test description</p>
</div>
</div>
And some CSS:
.image {
float: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 50%;
padding: 10px 20px 10px 0;
}
.text {
float: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 50%;
padding: 10px 0 10px 20px;
border-left: 1px solid black;
}
.project:first-child .image,
.project:first-child .text {
padding-top: 0;
}
.project:last-child .image,
.project:last-child .text {
padding-bottom: 0;
}
JSFiddle
That should get you started!
Try this:
div.element:nth-of-type(1) img {
padding-top: /* some value */;
}
The :nth-of-type(), and similar, pseudo-classes act on elements in the context of their parent. In other words, it only evaluates direct siblings. Your individual <img> elements are not siblings of each other, because they have different parents.

Categories