I'm creating a section that spans 50% of the page. Within that section I would like to place a box of text containing two lines which will lineup with the bullet points on the list to the righthand side. Why is it not putting the box inside the main section if I nested the divs?
<div class="content">
<h2>Brigham Young University</h2>
<h3><span>Computer Engineering, Minor in Computer Science</span></h3>
<ul>
<li>3.36 GPA</li>
<li>4.0 STEM GPA</li>
</ul>
<div id="grad_date">
<p>Provo, UT <br>
Expected 2018</p>
</div>
</div>
The Css:
.content {
border-width: 3px;
border-style: solid;
border-color: black;
margin-left: 15px;
margin-right: 15px;
width: 50%;
}
.content #grad_date {
border-width: 2px;
border-color: red;
border-style: solid;
width: 100px;
float: right;
}
Add display: inline-block; to .content:
JS Fiddle
You need to change the display rule for the unordered list to inline-block.
Also make sure to clear the float by adding overflow: hidden to the .container div. Which is one way to do it.
.content {
border-width: 3px;
border-style: solid;
border-color: black;
margin-left: 15px;
margin-right: 15px;
width: 50%;
overflow: hidden;
}
.content ul {
display: inline-block;
}
.content #grad_date {
border-width: 2px;
border-color: red;
border-style: solid;
width: 100px;
float: right;
}
<div class="content">
<h2>Brigham Young University</h2>
<h3><span>Computer Engineering, Minor in Computer Science</span></h3>
<ul>
<li>3.36 GPA</li>
<li>4.0 STEM GPA</li>
</ul>
<div id="grad_date">
<p>Provo, UT <br />
Expected 2018</p>
</div>
</div>
Related
I am making this card using React, HTML and CSS
Here is my Code:
<div className="plan">
<div className="plan-name">
<h5>BASIC</h5>
</div>
<div className="plan-price">
<h2>$ 6.99</h2>
<span>Screen Availabilty Simultaneously</span>
</div>
<div className="plan-details">
<ul>
<li>
<span>
<CheckIcon />
</span>
Access to All Library in Unlimited
</li>
<li>New Content Monthly</li>
<li>Available on PC, Smartphones and tablet</li>
<li>Drawing in Color</li>
<li>Color in Very High Quality</li>
<li>Canceable at Any Time</li>
</ul>
</div>
</div>
CSS:
.plan {
border-radius: 25px;
overflow: hidden;
background-color: #fff;
}
.plan-name {
background-color: #3e104f;
padding: 25px 0;
border-style: solid;
border-width: 0;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
}
.plan-price {
color: #3e104f;
background-color: #fff;
padding: 35px 0;
}
.plan-details {
background-color: #3e104f;
height: 100%;
border-radius: 20px;
}
Output:
But I am getting the white border which I have highlighted above, on all corners. Can anyone tell me where am I doing wrong? Or from where it is coming? How do I hide it?
It's normal behavior, you have no mistake in your CSS.
Possible solution is to make something like this
.plan {margin-top: 25px; overflow: visible;} /* here just remove overflow: hidden to show .plan-name outside of .plan */
.plan-name {margin-top: -25px; border-top-right-radius: 25px; border-top-left-radius: 25px;}
Using this code .plan's radius is hidden underneath .plan-name and isn't visible in corners.
just adding .plan {overflow: auto;} works for me as well
I know this question has been asked before. I'm just practicing web design, and pretending to create a website for a martial arts school (Nashville Self-Defense is not a real business).
I'm having a problem, the top-margin value of #Slogan does not seem to be working. As a matter of fact, getting top and bottom margins to work has been a lingering problem I've continually encountered.
The result:
Can anyone solve this?
#Title {
border-width: 1px;
border-style: solid;
border-color: greenyellow;
width: 50%;
float: left;
margin-left: 45px;
margin-top: 10px;
margin-bottom: 0;
height: 42px;
}
#Title h1 {
font-family: Stencil, sans-serif;
font-size: 42px;
margin-top: 2px;
margin-left: 9px;
}
#Slogan {
border-width: 1px;
border-style: solid;
border-color: green;
width: 50%;
height: 50px;
float: left;
margin-left: 14%;
margin-top: none;
display: inline-block;
}
<div id="Container">
<div id="TopofPage">
<div id="Title">
<h1>Nashville Self-DEfense</h1>
<div id="Slogan"></div>
</div>
<div id="SocialMedia"></div>
<!--not shown in image-->
</div>
<div id="TopMenu">
<ul>
<li>HOME</li>
<li>CLASSES</li>
<li>STORE</li>
<li>ABOUT</li>
<li>CONTACT</li>
</ul>
</div>
Instead of margin-top:none; use margin-top: 0px !important
It has to be
margin-top: 0;
not
margin-top: none;
next thing is it go higher on '0' as long as the previous element(#title h1) has margin set.
I am working on a Google site for a school project. However, the site looks like
instead of
I did not add the extra stuff, Google sites added it for me. Is there any way to get rid of it?
.titlebox {
display: block;
margin: 10px;
padding: 50px;
background-color: yellow;
border-radius: 10px;
border: 2px solid black;
text-align: center;
}
.map {
margin: 10px;
display: inline;
float: left;
padding: 20px;
background-color: green;
border-radius: 10px;
border: 2px solid black;
}
.content {
margin: 10px;
display: inline;
float: right;
padding: 20px;
background-color: orange;
border-radius: 10px;
border: 2px solid black;
}
a div {
color: black;
text-decoration: none;
padding: 5px;
border-radius: 10px;
border: 2px;
}
a:hover div {
color: orange;
text-decoration: none;
padding: 5px;
border-radius: 10px;
border: 2px;
background-color: blue;
}
<div class="titlebox">
<h1>GMO DEBATE</h1>
</div>
<div class="map">
<div text-align="center">
<h3>pages:</h3>
</div>
<ul>
<li>
<a href="pro">
<div>why GMOs should be labeled</div>
</a>
</li>
<li>
<a href="con">
<div>why GMOs shouldn't be labeled</div>
</a>
</li>
<li>
<a href="info">
<div>background information</div>
</a>
</li>
</ul>
</div>
<div class="content">
<h3>Should GMOs be labeled?</h3>
</div>
That is in a code box, although I don't think it matters since the extra stuff was there before I even added anything. Adding a width to the elements does not help.
As you said its code box in code box you can display your content only in limited area you will be allotted only some give space 75% or 70% of page display area.
If you need Your website on full page like as you want find a free host site like http://www.000webhost.com and host you web pages you can do what ever you want
I am trying to align three divs inside of a fourth div to create something similar to what you see on this page: http://www.thedistillerydistrict.com/
I can't seem to get the inside divs (#Entertainment, #Community, #welcome) align side by side inside the #HomeMain div
This is from the html
<div id = "HomeMain">
<div id="welcome">
<p>Finest Booze around, come taste for yourself Home to many of Toronto's hottest designer boutiques, unique cafes, artisan shops, breathtaking art galleries, performance venues and award-winning restaurants, The Distillery District is the place to see and be seen. An internationally acclaimed pedestrian-only village, The Distillery features more than 70 ground-floor cultural and retail establishments in the restored red brick, Victorian-era buildings of the renowned Gooderham & Worts whiskey distillery. One of Canada's hottest tourist attractions, centrally-located and just a short walk from downtown Toronto there is always something happening at The Distillery.</p>
<div class = "Oldman"></div>
</div>
<div id = "Entertainment">
<img src="images/Entertainment1.jpg" id="EntSlide" width=125 height=70 />
</div>
<div id = "Community">
<img src="images/Victoria1.jpg" id="ComSlide" width=125 height=70 />
</div>
</div>
Here is the CSS
#HomeMain{
width: 100%;
float: left;
overflow:hidden;
margin:0 auto;
padding:5px;
border-style: groove;
border-width: 3px;
border-colour: white;
border-radius: 5px 5px 5px 5px;
}
#Entertainment #Community{
float: left;
width: 25%;
border-style: groove;
border-width: 3px;
border-colour: white;
border-radius: 5px 5px 5px 5px;
}
#welcome{
float: left;
width:50%;
position: relative;
border-style: groove;
border-width: 3px;
border-color: white;
border-radius: 5px 5px 5px 5px;
font-weight: bold;
padding:15px;
}
Check this fiddle link http://jsfiddle.net/hek7fLy2/
All i have done is use the box-sizing css property to achieve the desired result. Also I assume you would want the images in the 2 smaller divs to be centered, so this takes care of that.
I have not changed your HTML code but i tweaked just a little bit of css code including the typo..
#HomeMain{
width: 100%;
float: left;
overflow:hidden;
margin:0 auto;
padding:5px;
border-style: groove;
border-width: 3px;
border-colour: white;
border-radius: 5px 5px 5px 5px;
box-sizing:border-box;
}
#Entertainment, #Community{
float: left;
width: 25%;
border-style: groove;
border-width: 3px;
border-colour: white;
border-radius: 5px 5px 5px 5px;
box-sizing:border-box;
}
#welcome{
float: left;
width:50%;
position: relative;
border-style: groove;
border-width: 3px;
border-color: white;
border-radius: 5px 5px 5px 5px;
font-weight: bold;
padding:15px;
box-sizing:border-box;
}
img{
display:block;
margin: 0 auto;
}
You forgot the the comma in the second rule and in order to make it right you have to use the box-sizing: border-box;.
#HomeMain {
width: 100%;
float: left;
overflow: hidden;
margin: 0 auto;
padding: 5px;
border-style: groove;
border-width: 3px;
border-colour: white;
border-radius: 5px;
box-sizing: border-box;
}
#Entertainment,
#Community {
float: left;
width: 25%;
border-style: groove;
border-width: 3px;
border-colour: white;
border-radius: 5px;
box-sizing: border-box
}
#welcome {
float: left;
width: 50%;
position: relative;
border-style: groove;
border-width: 3px;
border-color: white;
border-radius: 5px;
font-weight: bold;
padding: 15px;
box-sizing: border-box
}
<div id="HomeMain">
<div id="welcome">
<p>
Finest Booze around...
</p>
<div class="Oldman"></div>
</div>
<div id="Entertainment">
<img src="http://dummyimage.com/125x70" id="EntSlide">
</div>
<div id="Community">
<img src="http://dummyimage.com/125x70" id="ComSlide">
</div>
</div>
Check this fiddle
First of all it should be
#Entertainment,#Community{
and not
#Entertainment #Community{
next, why your divs arent aligning is because you are specifying a border of 3px each for the 3 divs which makes the divs to jump to the next line.So, here i've used box-sizing: border-box property for each of the divs.
Try it..
<div id = "HomeMain">
<div id="welcome">
Finest Booze around
</div>
<div id = "Entertainment">
Finest Booze around,
</div>
<div id = "Community">
Finest Booze around,
</div>
</div>
css use display property
#HomeMain{
width: 100%;
float: left;
overflow:hidden;
margin:0 auto;
padding:5px;
border-style: groove;
border-width: 3px;
border-colour: white;
border-radius: 5px 5px 5px 5px;
display:block;
}
#Entertainment, #Community,#welcome{
width: auto;
border-style: groove;
border-width: 3px;
border-colour: white;
border-radius: 5px 5px 5px 5px;
background:#ccc;
display:inline-block;
}
fiddle
http://jsfiddle.net/tnmzo1gc/
You have a typo in the CSS
#Entertainment #Community{
should be
#Entertainment, #Community{
I hope it solves your problem:) If not, please elaborate on a question.
I am trying to achieve this:
...as a format for news articles on my site (runic-paradise.com). You can see I've achieved everything except the orange bits. I'm trying to make the orange bits their own divs so I can put them in colored square backgrounds - to resemble something like this:
...however, I can't seem to get the divs to do what I want. It ends up messing up the 2 lower divs holding the image and text content. Anyone have any quick tips on how to achieve this? :(
JSFiddle of what I have so far:
http://jsfiddle.net/HDbq6/1/
HTML:
<div class="articleshell">
<div class="articletitle">
<h4 class="newstitleh4">A shining beacon in the desert - November 5, 2013</h4>
</div>
<div class="articleauthor">
Author
</div>
<div class="articleimg">
<img src="images/thumbs/EukitoDesertTempleThumb.jpg" width="90" height="90" class="news_thumb" alt="Eukito's Desert Temple" />
</div>
<div class="articletext">
<p>Eukito has completed construction of his desert temple. Of course no temple is complete without a secret passage or two... Stop on by at night to see it shining in the desert!</p>
</div>
</div>
CSS
.articleshell {
width: 770px;
max-height: none;
min-height: 130px;
padding-top: 5.px;
padding-right: 5.px;
padding-bottom: 5.px;
padding-left: 5.px;
padding-top: 1px;
padding-right: 5px;
padding-bottom: 5px;
padding-left: 5px;
background-color: #564D4D;
}
.articletext {
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
clear: both;
}
.articleimg {
float: left;
margin-right: 15px;
margin-bottom: 5px;
width: 90px;
height: 90px;
margin-left: 5px;
clear: both;
}
.articletitle {
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top: 3px;
float: left;
}
.newstitleh4 {
margin-bottom: 2px;
margin-top: 2px;
}
.articleauthor {
float: left;
text-align: right;
}
.articlecontent {
clear: both;
}
Something like this ?
fiddle
.main{width:500px; height:200px; border:1px solid #ccc; background:#f3f3f3; padding:5px;}
#title{width:45%; background:#ccc; border:1px solid #333; display: inline-block;}
.buttons{width:15%; background:orange; display: inline-block; border:1px solid #333;}
.mainContent{ width:100%; color:#ccc; border:1px solid #333; margin-top:5px; height:170px;}
<div class="main">
<div id="title">Title</div>
<div class="buttons">Author</div>
<div class="buttons">Role</div>
<div class="buttons">Date</div>
<div class="mainContent"></div>
</div>
The title id have a display:inline-block and div to get the thumb and the text content, that way the "buttons" don't mess up with the content. (I think)