I want to move the text "Hi" downwards because the PNG file makes it separate too much from the rest of the text.
body {
background-color: #1d1d1d;
}
.content {
padding-top: 200px;
padding-bottom: 200px;
padding-left: 100px
}
.content > h1 {
color: white;
font-family: 'Montserrat', sans-serif;
font-size: 30px;
}
<article id="main" class="content">
<h1>Hi, <br/>
I'm <img src="../Sources/Untitled-2.png" alt="V">ictor,
<br/> just another Video Editor.
</h1>
</article>
You can add a <p> tag to your "Hi," to be able to refer to that part of the text only. In this case, I added a class as well <p class="hiText">Hi, </p>.
Then in the CSS, I referred to the hiText class and applied the following properties:
position: absolute; This sets the position of the text to absolute.
padding-top: -40px; This moves the text downwards. You can change 40px to any desired number and/or measurement unit.
Hope this answers your question!
body {
background-color: #1d1d1d;
}
.content {
padding-top: 200px;
padding-bottom: 200px;
padding-left: 100px
}
.content > h1 {
color: white;
font-family: 'Montserrat', sans-serif;
font-size: 30px;
}
.hiText {
position: absolute;
padding-top: -40px;
}
<article id="main" class="content">
<h1><p class="hiText">Hi, </p><br/>
I'm <img src="../Sources/Untitled-2.png" alt="V">ictor,
<br/> just another Video Editor.
</h1>
</article>
I put "Hi," in a <p class="hiText"> </p> and then used
.hiText {
position: relative;
top: 38px;
}
Related
I am confused by the margin when I write the code:
Section {
background-color: #FFFFFF;
width="100%";
}
p1 {
font-family: Roboto;
font-size: 22px;
font-height: 1px;
margin-top: 45px;
margin-left: 165px;
}
p2 {
font-family: Roboto;
font-size: 22px;
font-height: 1px;
margin-top: 10px;
margin-left: 165px;
}
<section>
<p class="p1"> Content 1 </p>
<p class="p2"> Content 2 </p>
</section>
However, when I don't add the display, the background in section will not cover all the content. when I add the display: inline-block, it will cover but it will have the same first situation when I change display:inline-block to display: inline or display:block. So everyone can explain me what is happening please?
Add overflow:auto or overflow:hidden or overflow:scroll.
section {
background-color: red;
width: 100%;
overflow:auto; // added
}
.p1 {
font-family: Roboto;
font-size: 22px;
margin-top: 45px;
margin-left: 165px;
}
.p2 {
font-family: Roboto;
font-size: 22px;
margin-top: 10px;
margin-left: 165px;
}
<section>
<p class="p1"> Content 1 </p>
<p class="p2"> Content 2 </p>
</section>
The only issue is with you misused the double quotes in the width property of your section CSS, also the class selectors in your css haven't started with ".", so just update your css it will definately work.
This question already has answers here:
What is a clearfix?
(10 answers)
What methods of ‘clearfix’ can I use?
(29 answers)
Closed 4 years ago.
Okay so, Building an account page, and using the same kind of method we normally use when constructing pages, we seem to have this issue where it's like a large white block/space is in the background, so essentially some kind of element or div with white background colour. Only issue is, there isn't anything that should be causing this, and it most certainly isn't the body.
See image
(minor details aside, it is not finished as work has stopped due to this issue!)
The account and operative buttons elements (columns) are supposed to have a white background, while the background behind these two divs should be green. We assumed this would be the body.
body {
font-family: 'nunito', sans-serif;
/*width: 100%;*/
height: 100%;
background-color: #049E84 !important;
overflow: hidden;
align-content: center;
float: inherit;
margin-top: 0;
}
#account {
margin-top 100px;
padding: 50px;
margin-bottom: 100px;
/* font-family: 'nunito', sans-serif; */
/* float: inherit;*/
/* width: 70%;*/
/* margin-left: 19%;*/
/* margin-top: 0;*/
align-content: center;
background-color: #049E84;
}
#info {
text-align: center;
width: 60%;
height: 75%;
background-color: white;
padding: 25px;
font-family: 'nunito', sans-serif;
font-size: 35px;
color: dimgrey;
float: left;
border-radius: 60px;
}
#operativeButtons {
text-align: center;
padding: 25px;
margin-left: 30px;
background-color: white;
border-radius: 60px;
width: 15%;
height: 75%;
float: right;
}
#yourAccount {
font-family: 'nunito', sans-serif;
font: bolder;
color: #282828
}
#valid {
color: grey;
padding-top: 20px;
font-weight: bold;
}
#tickets {
color: #049e84;
}
#warning {
color: #ff0000;
}
#uname {
display: inline;
}
p {
line-height: 1;
}
.title {
padding-top: 10px;
color: black;
}
#bg {
background-color: #049e84;
}
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
<div id="bg">
<div id="account">
<div id="info">
<div id="yourAccount">
YOUR ACCOUNT</div>
<hr style="height:1px;border:none;color:#049e84;background-color:#049e84;" />
<p class="title">Username:</p>
<p id="username" class="details"></p>
<p class="title">Name:</p>
<p id="name" class="details"></p>
<p class="title">Email:</p>
<p id="email" class="details"></p>
<p class="title">Phone:</p>
<p id="phone" class="details"></p>
<p class="title">Address:</p>
<p id="address" class="details"></p>
<p class="title">Your Tickets:</p>
<p id="tickets" class="details"></p>
<p id="valid"></p>
<hr style="height:1px;border:none;color:#049e84;background-color:#049e84;" />
</div>
<div id="operativeButtons">
<p id="home">Home</p>
<p id="logout">Logout</p>
<p id="deleteaccount">Delete Account</p>
<p id="warning">WARNING:</p>
<p id="warningmessage">Deleting your account will entirely erase all your data from our database. By
clicking, you acknowledge this. <br> All tickets will be erased</p>
</div>
</div>
</div>
Please note in the code above that the html and body tags are closed later after the PHP, this isn't the issue. :)
any help would be greatly appreciated, I am completely perplexed! That being said though, I'm also very tired.
Looks like you lack a clear of the floats, that's why the parent element (#account) does not get the expected height.
You can use a clear fix like this:
#account:after {
content: "";
display: table;
clear: both;
}
more info here:
https://css-tricks.com/snippets/css/clear-fix/
Another dirty way to do it is adding <br clear="all"/>. before closing #account.
Can someone please help me out why my "desc" content is not right under my title in the banner? I have posted my CSS and HTML code. I have also posted the photo of how the outcome looks.
#bannerBottom {
border: 5px #0087dd solid;
margin-top: 30px;
margin-bottom: 50px;
}
#bannerImg {
width: 150px;
margin-top: 7px;
margin-left: 10px;
display: inline-block;
}
#bannerContent {
display: inline-block;
vertical-align: top;
margin-left: 20px;
}
#bannerContent>span {
font-size: 20px;
font-weight: bold;
font-family: arial;
color: steelblue;
display: inline-block;
}
#desc {
font-family: arial;
display: inline-block;
margin-left: 190px;
}
<div id="bannerBottom">
<img id="bannerImg" src="http://www.placehold.it/100x100">
<p id="bannerContent">
<span>The Big 3 - HTML, CSS, JavaScript</span>
</p>
<p id="desc">While the server can process information in many different languages, the file that they serve to the client are always going to be some combination of HTML, CSS, and JavaScript!<br>Learn more about the Big 3 here!</p>
</div>
You can float your image left instead of making it an inline-block element. Also there'd be no need to make the paragraph an inline-block either.
#bannerBottom {
border: 5px #0087dd solid;
margin-top: 30px;
margin-bottom: 50px;
}
#bannerImg {
width: 150px;
margin-top: 7px;
margin-left: 10px;
float: left;
}
#bannerContent {
display: inline-block;
vertical-align: top;
margin-left: 20px;
}
#bannerContent>span {
font-size: 20px;
font-weight: bold;
font-family: arial;
color: steelblue;
display: inline-block;
}
#desc {
font-family: arial;
margin-left: 190px;
}
<div id="bannerBottom">
<img id="bannerImg" src="http://www.placehold.it/100x100">
<p id="bannerContent">
<span>The Big 3 - HTML, CSS, JavaScript</span>
</p>
<p id="desc">While the server can process information in many different languages, the file that they serve to the client are always going to be some combination of HTML, CSS, and JavaScript!<br>Learn more about the Big 3 here!</p>
</div>
Surely it is because you have:
#desc {
margin-left: 190px;
}
... which means the box isn't fitting under the title, so it is getting shunted underneath. Either way, float the image left and don't have margin-left.
try this:
<div id="bannerBottom">
<div class="container-banner-img">
<img id="bannerImg" src="http://www.placehold.it/100x100">
</div>
<div class="container-banner-content">
<p id="bannerContent">
<span>The Big 3 - HTML, CSS, JavaScript</span>
</p>
<p id="desc">While the server can process information in many different languages, the file that they serve to the client are always going to be some combination of HTML, CSS, and JavaScript!<br>Learn more about the Big 3 here!
</p>
</div>
</div>
CSS
#bannerBottom {
border: 5px #0087dd solid;
margin-top: 30px;
margin-bottom: 50px;
}
#bannerImg {
width: 150px;
margin-top: 7px;
margin-left: 10px;
display: inline-block;
}
#bannerContent {
display: inline-block;
vertical-align: top;
margin-left: 20px;
}
#bannerContent>span {
font-size: 20px;
font-weight: bold;
font-family: arial;
color: steelblue;
display: inline-block;
}
#desc {
font-family: arial;
display: inline-block;
margin-left: 190px;
}
.container-banner-img {
float: left; /* <- pay attention on this line */
width:25%;
}
.container-banner-content{
width: 70%;
}
}
If you don't want to go the flexbox route you can float the image and keep your heading and description block level.
I took a few liberties with the markup and CSS selectors, changing them from IDs to classes and other improvements to streamline everything.
.entry {
font-family: Arial, sans-serif;
border: 5px solid #0087dd;
margin: 30px 0;
}
.entry-img {
float: left;
max-width: 150px;
margin: 10px;
}
.entry-title {
font-size: 20px;
color: steelblue;
}
.entry-desc {
margin: 10px;
}
<div class="entry">
<img class="entry-img" src="http://www.placehold.it/100x100">
<h2 class="entry-title">The Big 3 - HTML, CSS, JavaScript</h2>
<p class="entry-desc">While the server can process information in many different languages, the file that they serve to the client are always going to be some combination of HTML, CSS, and JavaScript!<br>Learn more about the Big 3 here!</p>
</div>
I have 5 paragraph markers that are all floating next to each other using a CSS Class.
When I add my 6th paragraph marker I assumed and wanted it to move down, however it is floating next to the other 5.
I created this jsfiddle so you can see what I have so far,
<http://jsfiddle.net/rtze3a8g/1/>
Basically I am trying do design my own tab bar.
New to this so I hope I explained it properly. Thank you for your patience.
Try with this: jsFiddle
When you have float elements adjacent each others, if you want some of them take the entire line (acting as 'block' element), you need to use clear: both
You can also use clear:left to clear float left
* {
margin: 0;
padding: 0;
}
html {
font-size: 100%;
}
body {
font: 62.5%/1.5 Verdana, Arial, Helvetica, sans-serif;
color: #000000;
background: #6D9BF1;
padding: 20px;
}
#wrapper {
font-size: 1.2em;
line-height: 1.5em;
background-color: #ffffff;
width: 700px;
margin-left: auto;
margin-right: auto;
}
p {
margin-bottom: 1.5em;
}
p.newLine{clear:left;}
p.ribbon{
float: left;
padding: 5px 10px 5px 10px;
font-weight: bold;
}
p.ribbon:hover{
background-color: #87CEEB;
color: white;
}
p.reset{
float: none;
}
<!DOCTYPE html>
<title>Enter Title Here</title>
<script>
function newfunction(){
}
</script>
<body>
<div id="wrapper">
<p class="ribbon">Home</p>
<p class="ribbon">History</p>
<p class="ribbon">Location</p>
<p class="ribbon">Photos</p>
<p class="ribbon">Contact Us</p>
<p class="newLine">This is test information</p>
<p>This is test information</p>
</div>
</body>
</html>
This is probably a silly question but I can't seem to figure out how to auto center my section
live demo: http://iam.colum.edu/students/jordan.max/algorerhythm/index.html#
I have tried to add
margin: 0 auto;
to my div#content, with no luck.
The only way I was able to get it be centered was manually entering in
margin-left: xxpx
but I want it to be centered based on what content is in it. Any thoughts? Thanks in advance.
Rest of CSS
body
{
background: #C1CDC1;
}
h1
{
}
h2
{
margin-top: -40px;
margin-left: 120px;
}
h1.mainT
{
width: 590px;
font-family: 'Montserrat', sans-serif;
margin-left: 10px;
font-size: 2.5em;
}
h2.subT
{
width: 130px;
font-family: 'Open Sans Condensed', sans-serif;
}
h3
{
display: inline-block;
font-family: 'Open Sans Condensed', sans-serif;
}
footer
{
color: #FCFCFC;
text-align: center;
font-family: 'Montserrat', sans-serif;
font-size: .85em;
}
section#nav
{
width: auto;
margin-left: 550px;
margin-top: -80px;
padding: 5px;
word-spacing: 80px;
}
div#navContainer
{
height: 100px;
background: #FCFCFC; /* grey99*/
box-shadow: 2px 3px 5px #333;
}
div#content
{
height: 100px;
width: auto;
background: #FCFCFC; /* grey99*/
box-shadow: 2px 3px 5px #333;
display: inline-block;
}
section#contentContainer
{
float: none;
padding-top: 20px;
margin: 0 auto;
}
HTML
<script>
$(document).ready(function () {
$('section#contentContainer').hide();
var $as = $('a.contentDown').click(function () {
//show back button, move it from left +300
$('section').show();
}); //closes click for contentDown
}); //closes ready
</script>
</head>
<body>
<div id="navContainer">
<h1 class="mainT"> Al Gore Rhythm Labs </h1>
<h2 class="subT"> Chicago, IL </h2>
<section id="nav">
<h3> Assignments </h3>
<h3> Writings </h3>
<h3> Presentations </h3>
</section>
</div>
<section id="contentContainer">
<div id="content">
<p> hello motto
</p>
</div>
</section>
</body>
<footer>
<p> Jordan Max 2014</p>
</footer>
</html>
Maybe this is the solution (don't forget to remove style="display: none;" for your section#contentContainer)
Result:
Add text-align center; to your section#contentContainer
section#contentContainer
{
float: none;
padding-top: 20px;
margin: 0 auto;
text-align: center;
}
Good Luck!!
Add 'align="center"' to your section element.
As follows:
<section id="contentContainer" align="center">
This is not the preferred way but if you want to do it only in CSS, you would need to do 'text-align: center' on the element to center align it's internal 'inline-block' element.
CSS: text-align: center