I tried the opacity with the help of this. It does work well, except for one thing. The div where I want to use the opacity has other contents in it too. So, when I use opacity in that parent div, the child div also gets effected! What to do so as to effect only the parent div and not the child divs? Any help will be greatly appreciated. Thank you.
html:
<div id="profile_rightbar">
<div id="shortcuts">
<div class="icon pink">
<a href="#">
<p>Pictures</p>
<p>210</p>
</a>
</div>
<div class="icon green">
<a href="#">
<p>Videos</p>
<p>210</p>
</a>
</div>
<div class="icon blue">
<a href="#">
<p>Forums</p>
<p>210</p>
</a>
</div>
<div class="icon orange">
<a href="#">
<p>Pages</p>
<p>210</p>
</a>
</div>
<div class="icon pink">
<a href="#">
<p>Followers</p>
<p>210</p>
</a>
</div>
<div class="icon green">
<a href="#">
<p>Following</p>
<p>210</p>
</a>
</div>
</div>
<div id="status">
<p>Always do your best. What you plant now, you will harvest later.</p>
</div>
<div id="write">
<textarea id="redactor" name="content">
<h2>Hello and Welcome</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</textarea>
</div>
<div id="activity">
<div class="picture">
<a href="#">
<p>The world is so perfect. How can one not love this beautiful world.</p>
<img src="image/world.jpg">
</a>
</div>
<div class="picture">
<a href="#">
<p>The world is so perfect. How can one not love this beautiful world.</p>
<img src="image/world.jpg">
</a>
</div>
<div class="forum">
<a href="#">
</a>
</div>
<div class="video">
<a href="#">
</a>
</div>
<div class="page">
<a href="#">
</a>
</div>
<div class="following">
<a href="#">
</a>
</div>
</div>
</div>
<div class="clear_right"></div>
css:
html, body {
width: 100%;
height: 100%;
}
#main_wrapper {
width:100%;
height: 100%;
background:url(../image/pantera.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-ms-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#profile_page {
width: 800px;
margin: 0 auto;
overflow: hidden;
border: 1px solid red;
}
#username h1 {
text-align: center;
color: white;
}
#profile_leftbar {
width: 210px;
float: left;
}
#profile_picture {
background-color: white;
border-radius: 10px;
border: 1px solid #dbdbdb;
}
#profile_picture img {
display: block;
margin: 0 auto;
border: none;
max-width:190px;
padding: 8px;
}
#about {
background: #f4f4f4;
border-radius: 5px;
margin-top: 8px;
border: 1px solid #dbdbdb;
}
#about p {
text-align: center;
color: #000000;
padding-top: 3px;
padding-bottom: 3px;
}
#about hr {
height:1px;
border:0px solid ;
border-top:1px solid #ccc;
}
#follow_message {
width: 210px;
margin: 5px auto;
}
#follow_message li {
list-style-type: none;
float: left;
margin-left: 3px;
}
#follow_message a {
display: block;
width: 101px;
text-align: center;
height: 30px;
color: white;
text-decoration: none;
line-height: 30px;
margin: 2px 0;
background: maroon;
}
#profile_rightbar {
float: right;
width: 590px;
}
#shortcuts {
overflow: hidden;
width: 588px;
margin: 0 auto;
}
#shortcuts div {
float: left;
margin: 4px;
}
.icon a {
text-decoration: none;
text-align: center;
display: block;
color: white;
border-radius: 5px;
width: 88px;
padding: 1px;
}
.icon a:hover {
text-decoration: underline;
}
.pink a {
background-color:#d63175;
}
.green a {
background-color:#51b73c;
}
.blue a {
background-color:#2f8ae0;
}
.orange a {
background-color:#f7a809;
}
#status {
background-color:white;
box-shadow:5px 5px 20px 1px black;
max-width:490px;
word-wrap:break-word;
padding:6px;
margin: 15px auto;
text-align:center;
font-size:30px;
line-height: 32px;
}
#write {
width: 575px;
margin: 0 auto;
}
#write textarea {
font-size:20px;
max-width:575px;
width: 575px;
}
#activity {
margin: 10px;
width: 575px;
}
#activity {
border: solid red;
opacity: 0.2;
filter: alpha(opacity=20); /* IE8 and lower */
zoom: 1;
#activity div {
background: white;
margin: 0 auto;
}
#activity .picture a img {
display: block;
max-width: 540px;
margin: 0 auto;
}
.picture a {
color: black;
text-decoration: none;
}
.picture a p {
margin-top:15px;
margin-left:15px;
}
dont use opacity it affects all child elements
Use
background-color : rgba(255,255,255,0.2);
which blurs only the parent element.
Related
*Hello, I want to have text below the image like in the example, but I can't figure out what is wrong, i took the code from
W3Schools: https://www.w3schools.com
/css/tryit.asp?filename=trycss_ex_images_card
Can someone help? Thanks
Example Image: https://imgur.com/a/P86DVjW
What It Looks Like: https://imgur.com/a/JOXpAJI*
```{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
background: #32053d;
}
header {
position: absolute;
top: 0;
Left: 0;
width: 100%;
padding: 30px 100px;
display: flex;
justify-content: space-between;
align-items: center
}
header .logo
{
color: #fff;
font-weight: 700;
text-decoration: none;
font-size: 2em;
text-transform: uppercase;
letter-spacing: 2px;
}
header ul
{
display: flex;
justify-content: center;
align-items: center;
}
header ul li
{
list-style: none;
margin-left: 20px;
}
header ul li a
{
text-decoration: none;
padding: 6px 15px;
color: #fff;
border-radius: 20px;
}
header ul li a:hover,
header ul li a.active
{
background: #fff;
color: #4a2880;
}
h1 {
color: white;
margin-top: 250px;
margin-left: 270px;
}
p {
color:white;
margin-left: 60px;
text-align: center;
font-size: 15px;
}
.sec {
margin-right: 80px;
}
div.polaroid {
width: 80%;
background-color: white;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
margin-bottom: 25px;
}
div.container {
text-align: center;
padding: 10px 20px;
}
```<!DOCTYPE html>
<html>
<h1>ABC</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<center><img src="images/ArrowDown.webp" id="arrow" width="200"></center>
<div class="sec">
<center> <div class="polaroid">
<img src="Images/Darbs1.png" alt="Darbs1" style="width:100%">
<div class="container">
<p>Code</p>
</div>
</div> </center>
<center> <div class="polaroid">
<img src="images/Darbs1.png" alt="Darbs2" style="width:100%">
<div class="container">
<p>Code</p>
</div>
</div> </center>
<head>
<title>Projects</title>
<link rel="stylesheet" type="text/css" href="Website.css"
</head>
<body>
<header>
Logo
<ul>
<li>Home</li>
<li>About</li>
<li>Work</li>
<li>Contact</li>
</ul>
</header>
</body>
</html>```
The problem is with the css. You have set the p tag color:white that is why it is not showing. Set color:black
p {
color:black;
margin-left: 60px;
text-align: center;
font-size: 15px;
}
I approve of Usama's answer, the description is written in white on a white background.
You can add a specific rule:
.polaroid .container p {
color:black;
}
PS: Can you reformat your code?
Use 4 spaces or the button {} in the text editor
I have a header image on a page that I want to resize from the center, but by default the image resizes from the top down so the bottom of the image gets cut off instead of the top and bottom equally.
I have created a Fiddle to recreate the issue and the following code is the same as is in the fiddle. You can see as the window is resized to become bigger, the circles are cut off from view.
<div class="header-image" style="background-image: url(https://i.imgur.com/5AcO0gW.png) !important;">
<div class="line">
<hr class="position-absolute bluestrikethrough">
</div>
<div style="flex-grow: 0; flex-shrink: 0; ">
<h1 style="font-family: MillerItalic, Georgia, serif; font-size: 4em;" class="text-primary font-italic px-3">Big ol Title </h1>
</div>
<div class="line">
<hr class="position-absolute bluestrikethrough">
</div>
</div>
<div class="container">
<div class="py-3 px-5 border-bottom">
<h6>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</h6>
</div>
</div>
.bluestrikethrough {
z-index: 5;
top: 1.5em;
width: 100%;
border: none;
height: 3px;
color: #007bff;
/* old IE */
background-color: #007bff;
/* Modern Browsers */
}
.header-image {
display: flex;
background-size: cover !important;
background-color: #919191;
width: 100%;
border-radius: 0px !important;
padding-top: 7rem !important;
padding-bottom: 6rem !important;
margin-bottom: 0px;
margin-top: 0px !important;
}
.line {
position: relative;
width: 100%;
}
ul {
list-style-type: none;
}
#media (max-width: 480px) {
.header-image {
padding-bottom: 70px;
}
}
This can be done with the background-position property. I just added it to it like:
.header-image {
background-size: cover !important;
background-color: #919191;
width: 100%;
background-position: center; /*This line */
border-radius: 0px !important;
padding-top: 7rem !important;
padding-bottom: 6rem !important;
margin-bottom: 0px;
margin-top: 0px !important;
}
Although I ended up going with background-position: 50% 38%; for my real image.
here is my index.html:
<div id="container1" class="py-0 my-0">
<div id="left" class="col-md-6">
<img class="image" src="C:\Users\asus\Desktop\project\image.png">
</div>
<div id="right" class="col-md-6">
<nav class="navbar navbar-expand-lg">
<ul class="navbar-nav ml-auto">
<li class="nav-index">
HOME
</li>
<li class="nav-index">
ABOUT US
</li>
<li class="nav-index">
COURSES
</li>
<li class="nav-index">
LOG IN
</li>
</ul>
</nav>
<br>
<br>
<br>
<br>
<br>
<p class="paragraph col-md-6">
<h3 class="Welcome text-center">Welcome to mobile legends!</h3>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<br>
<br>
<footer class="footer1" id="footer1">
<h6>Contact the developer:</h6>
<p>luckyllemos0909#gmail.com</p>
</footer>
</div>
</div>
here is my style.css:
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body{
width: 100%;
height: 100%;
padding: 0;
margin: 0;
align-items: center;
vertical-align: middle;
}
#container1{
width: 100%;
height: 100%;
vertical-align: middle;
display: flex;
align-items: center;
}
#left,
#right {
width: 50%;
height: 100%;
}
#left {
background: #ffd6dd;
align-items: center;
}
.image{
margin-top: 50px;
margin-left: -10px;
padding: 100px;
}
#right {
background: #FBAED2;
align-items: center;
}
.paragraph{
color: red;
margin: 50px;
}
.fa {
margin-top: none;
padding: 20px;
font-size: 20px;
width: 30px;
text-align: center;
text-decoration: none;
margin: 5px 2px;
}
.fa:hover {
opacity: 0.7;
}
.fa-facebook {
color: #000000;
}
.fa-linkedin {
color: #000000;
}
.fa-youtube {
color: #000000;
}
.Welcome{
margin-left:60px;
}
.nav-link{
color: #000000;
}
.nav-index{
padding-left: 30px;
padding-right: 30px;
align-items: center;
}
my problem is when i put it in mobile phone it does not go flexible.
This is the original output:
and This what happens when try to look on mobile screen:
What you're looking for is media queries, which let you decide how your website looks on varying screen sizes. In the example below in the css class example is first shown how it would look on a larger screen size, then below with the media query in effect you can stylize how your page would look on a (in this example) a screen with a width of less than 900px. Take a look at the link below for further explanation.
.example {
font-family: "Droid+Sans";
font-weight: normal;
color: #ffffff ;
font-size: 7rem;
position: absolute;
top: 17%;
width: 100%;
}
#media screen and (max-width: 900px){
.example {
font-size: 3.5rem;
margin: auto;
width: 50%;
left: 20%;
right: 20%;
padding-bottom: 100px;
}
}
https://www.w3schools.com/css/css_rwd_mediaqueries.asp
Use Bootstrap Utility Classes in a better way. Since you are using bootstrap simply add your classes to work for different break points.
Add col-12 Utility classes on the following elements: Note that Bootstrap follows mobile-first approach.
<div id="left" class="col-12 col-md-6">
And
<div id="right" class="col-12 col-md-6">
I want my HTML/CSS to match what it does in the following picture:
This is currently what my HTML/CSS looks like:
There are four things that I am having issues with in my HTML/CSS that the picture is currently doing:
Align the text to the right of the checkbox in such a way that no text appears directly below the checkbox
Make the two buttons in the picture the same size
Make the two buttons centered according to the white text paragraph above
I can't seem to do #2 and #3 at the same time.
Any other discrepancies between the two pictures can be ignored.
How do I accomplish items 1-4 as mentioned above?
This is the plunker link: http://plnkr.co/edit/dfZg2C1ZrqdeSdoBa21t?p=preview
This is the HTML code:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div id="LoadingDiv">
<div class="LoadingText">
<p style="color:red"><strong>Attention! You must agree to continue with Online Forms</strong></p>
<p><input type="checkbox"/>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div class="btn-group">
<button class="btn btn-dont-allow">DON'T ALLOW</button>
<button class="btn btn-consent-ok">OK</button>
</div>
</div>
</div>
</body>
</html>
This is the CSS:
#LoadingDiv .btn {
min-width: 30%;
}
#LoadingDiv .btn-group {
margin-left:35%;
position: relative;
}
#LoadingDiv .LoadingText {
position: relative;
left: 25%;
top: 25%;
width: 50%;
color: white;
}
#LoadingDiv .btn-dont-allow {
background-color: #808083;
color: #ffffff;
padding: 3px 50px;
font-size: 16px;
margin-left: 3px;
margin-right: 3px;
}
#LoadingDiv .btn-consent-ok {
background-color: #1aa8de;
color: #ffffff;
padding: 3px 50px;
font-size: 16px;
margin-left: 3px;
margin-right: 3px;
}
#LoadingDiv {
margin: 0px 0px 0px 0px;
position: fixed;
padding: 0;
margin: 0;
top: 0;
left: 0;
height: 100%;
z-index: 9999;
width: 100%;
clear: none;
background-color: rgba(68, 176, 129, 0.9);
}
P.S: The markup in this picture was not created using HTML/CSS, but a prototyping app, so I can't just extract it from its source.
See this fiddle https://jsfiddle.net/DIRTY_SMITH/avocyf33/7/
added this
p {
display: block;
padding-left: 15px;
text-indent: -15px;
}
input {
width: 13px;
height: 13px;
padding: 0;
margin:0;
vertical-align: bottom;
position: relative;
top: -1px;
}
and added min-width: 400px; to btn-group to keep buttons from wrapping.
Jsfiddle
#LoadingDiv .btn {
min-width: 30%;
}
#LoadingDiv .btn-group {
display: inline-block;
}
#LoadingDiv .LoadingText {
position: relative;
left: 25%;
top: 25%;
width: 50%;
color: white;
}
#LoadingDiv .btn-dont-allow {
background-color: #808083;
color: #ffffff;
padding: 3px 50px;
font-size: 16px;
margin-left: 3px;
margin-right: 3px;
}
#LoadingDiv .btn-consent-ok {
background-color: #1aa8de;
color: #ffffff;
padding: 3px 50px;
font-size: 16px;
margin-left: 3px;
margin-right: 3px;
}
#LoadingDiv {
margin: 0px 0px 0px 0px;
position: fixed;
padding: 0;
margin: 0;
top: 0;
left: 0;
height: 100%;
z-index: 9999;
width: 100%;
clear: none;
background-color: rgba(68, 176, 129, 0.9);
}
.check {
width: 15px;
height: 15px;
padding: 0;
margin: 0;
vertical-align: bottom;
position: relative;
top: -3px;
}
.agree {
display: inline-block;
margin-left: 30px;
margin-top: -22px;
vertical-align: top;
}
<body>
<div id="LoadingDiv">
<div class="LoadingText">
<p style="color:red"><strong>Attention! You must agree to continue with Online Forms</strong>
</p>
<input type="checkbox" class="check">
<p class="agree">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div class="btn-group">
<button class="btn btn-dont-allow">DON'T ALLOW</button>
<button class="btn btn-consent-ok">OK</button>
</div>
</div>
</div>
</body>
</html>
I set the width of my page on 970px.
Everything is going well, even the paragraph is aligned within the margin but when I apply the color, it is outside the margin.
<div class="container">
<header>
<nav class="navbar navbar-default navegacion">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Cambiar NavegaciĆ³n</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<strong>Amixer Music</strong>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav textomenu">
<li>Inicio</li>
<li>Traductor Amixer</li>
<li>Yahoo Fail</li>
</ul>
</div>
</nav>
</header>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<img class="img-responsive" src="img/amixermusic2.png" alt="AmixerMusic"/>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 alineado">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</div>
</div>
// Not stuff like this which is a code comment :-)
html,
button,
input,
select,
textarea {
color: #222;
}
body {
font-size: 16px;
height: 100%;
}
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
img {
vertical-align: middle;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
textarea {
resize: vertical;
}
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
/*My personal css*/
/* Custom container */
.container{
padding: 0px;
max-width: 970px;
margin-top: 2%;
border: 5px solid #2E2E2E;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.imagen
{
width: 100%;
}
.navegacion
{
width: 100%;
margin-bottom: 0%;
}
.texto
{
font-family: 'Nunito', serif;
font-size: 25px;
text-shadow: 4px 4px 4px #aaa;
}
.textomenu
{
font-family: 'Nunito', serif;
font-size: 20px;
}
.alineado
{
background-color: orange;
margin-right: 0%;
margin-left: 0%;
}
.color2
{
background-color: blue;
}
It's because bootstrap auto add -15px to left and right margin of .row:
.row {
margin-left: -15px;
margin-right: -15px;
}
Try to reset it and you should be fine:
.row {
margin: 0
}
Demo