This question already has answers here:
Second line in li starts under the bullet after CSS-reset
(4 answers)
Li item on two lines. Second line has no margin
(8 answers)
Closed 7 months ago.
The text under the icon starts from far back. I couldn't find a solution as I'm not even beginner on HTML or CSS. If you can help me how to align the text I'd appreciate it.
Here is the HTML code:
A great fit for startups and scaleups:
<ul>
<li>Export data from your <strong>Marketing Data Sources</strong></li>
<li>Export your Marketing data to Google Sheets</li>
<li><strong>Daily refresh</strong> of data</li>
<li>Unlimited data sources</li>
<li>1 user</li>
<li>1 account per data source</li>
</ul>
This is another way.
<html>
<head>
<style>
ul.inside {
max-width: 200px;
list-style-position: outside;
}
</style>
</head>
<body>
<ul class="inside">
<li>Export data from your <strong>Marketing Data Sources</strong></li>
<li>Export your Marketing data to Google Sheets</li>
<li><strong>Daily refresh</strong> of data</li>
<li>Unlimited data sources</li>
<li>1 user</li>
<li>1 account per data source</li>
</ul>
</body>
<html>
You can approach it this way.
ul.inside {
max-width: 200px;
list-style-position: outside;
}
A great fit for startups and scaleups:
<ul class="inside">
<li>Export data from your <strong>Marketing Data Sources</strong></li>
<li>Export your Marketing data to Google Sheets</li>
<li><strong>Daily refresh</strong> of data</li>
<li>Unlimited data sources</li>
<li>1 user</li>
<li>1 account per data source</li>
</ul>
<br>
<br>
<h3>THIS IS ANOTHER WAY</h3>
<ul style="max-width: 200px; list-style-position: outside;">
<li>Export data from your <strong>Marketing Data Sources</strong></li>
<li>Export your Marketing data to Google Sheets</li>
<li><strong>Daily refresh</strong> of data</li>
<li>Unlimited data sources</li>
<li>1 user</li>
<li>1 account per data source</li>
</ul>
So I am trying to make a menu for a boba drink shop but when listing out the milk tea the list won't show on the right. Another was that when I tried adding another picture, it would overlap with the previous one.
.row {
clear: both
}
.column {
width: 20%;
float: left;
}
<div class="row">
<div class="column">
<h2><u>Yakult Tea</u></h2>
<u1>
<li>Mango</li>
<li>Peach</li>
<li>Kiwi</li>
<li>Passionfruit</li>
<li>Grapefruit</li>
<li>Strawberry</li>
<li>Green Apple</li>
<li>Red Apple</li>
<li>Lychee</li>
<li>Winter Melon</li>
<li>Orange</li>
</u1>
</div>
<div class="column">
<h2><u>Yogumuji Yogurt</u></h2>
<u1>
<li>Strawberry Yogurt</li>
<li>Fresh Yogurt</li>
<li>Passionfruit Yogurt</li>
<li>Purple Rice Yogurt</li>
<li>Mango Yogurt</li>
<li>Peach Yogurt</li>
<li>Kiwi Yogurt</li>
<li>Mulberry Yogurt</li>
<li>Lychee Yogurt</li>
<li>Pineapple Yogurt</li>
<li>Lemon Yogurt</li>
<li>Orange Yogurt</li>
<li>Cherry Yogurt</li>
</u1>
</div>
<div class="column">
<h2><u>Slush</u></h2>
<u1>
<li>Bamboo Charcoal</li>
<li>Chocolate</li>
<li>Honeydew</li>
<li>Taro</li>
<li>Peach</li>
<li>Pineapple</li>
<li>Plum Icy</li>
<li>Oreo</li>
<li>Passionfruit</li>
<li>Lychee</li>
<li>Matcha</li>
<li>Milk Tea</li>
<li>Strawberry(Milk)</li>
</u1>
</div>
<div class="column">
<br/>
<li>Mango(Milk)</li>
<li>Grapefruit</li>
<li>Kiwi</li>
<li>Green Apple</li>
<li>Red Apple</li>
<li>Grape</li>
<li>Kumquat lemon</li>
</div>
</div>
</body>
This is where the picture would overlap with the previous one.
<img src="https://popmenucloud.com/lptemfjr/973db751-7915-4c33-abcf-784ef635b66e.jpg" width="285" height="350">
<body>
<div class="row2">
<div class="column">
<style>
.row2 {
clear: both
}
.column {
width: 20%;
float: left;
}
</style>
</div>
<br/>
<h2><u>Macchiato Slush</u></h2>
<u1>
<li>Strawberry</li>
<li>Mango</li>
<li>Peach</li>
<li>Mulberry</li>
<li>PassionFruit</li>
<li>Lemon</li>
<li>Plum</li>
</u1>
</div>
<div class="column">
<br/>
<h2><u>Milk Tea</u></h2>
<u1>
<li>Sigature Milk Tea</li>
<li>Green Milk Tea</li>
<li>Honey Milk Tea</li>
<li>Mint Milk Tea</li>
<li>Caramel Milk Tea</li>
<li>Coconut Milk Tea</li>
<li>Almond Milk Tea</li>
<li>Oolong Milk Tea</li>
<li>Bamboo Charcoal Milk Tea</li>
<li>Tiramisu Milk Tea</li>
<li>Taro Milk Tea</li>
<li>Matcha Milk Tea</li>
<li>Barley Milk Tea</li>
<li>Strawberry Milk Tea</li>
<li>Winter Melon Milk Tea</li>
</u1>
</div>
</div>
</body>
Try this:
.column {
position: relative;
left: how many px it requires to go to the right;
}
How can we have image in new line and h2 in other line keeping all style in h2
we can see that both image and h2 are float together
we want to have both in different line
please give proper clarification so all other programmer also refer and use in there code
question is very simple have to use float and clear property but dont know where perfectly so please check it and reply as soon as possible
we have seen such issue many times
#back-to-top {
position: fixed;
bottom: 20px;
right: 20px;
}
h1, h2
{
background-color: black;
color: white;}
h1{
text-align: center;
}
h2{display:inline-block;
clear: both;}
img{
clear:both;
}
<!doctype html>
<html lang= "en">
<head>
<meta charset= "UTF-8">
<title>Recipe project - Module 1</title>
</head>
<body>
<h1 id = "top">My favorite Recipes: </h1>
<nav>
<ul>
<li><a href=#first>Panipuri</a></li>
<li><a href=#second>Handvo</a></li>
<li><a href=#third>Dosa</a></li>
</ul>
</nav>
<article>
<h2 id="first">Panipuri</h2>
<img src= "https://qph.ec.quoracdn.net/main-qimg-14f6bc4a3b89ae33a33107a9b56b38e7" alt="delicious pani puri plate" width= 350 title="once you have it you will forget all the items">
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>Kothamir Pani</li>
<li>Dates Pani</li>
<li>Puri</li>
<li>Masala Ragda</li>
</ul>
<q>Have it and forget everthing</q>
<p><strong>Steps:</strong></p>
<ol>
<li>Make Masal Ragda</li>
<li>make Kothmir pani</li>
<li>make Dates pani</li>
<li>take Puri and start eating</li>
</ol></article>
<br>
<article>
<h2 id="second">Handvo</h2>
<img src="http://somethingscookingwithalpa.com/wp-content/uploads/2017/11/handvo-WEB.jpg" alt = "handvo plate" width=350 title="handvo really teasty have it">
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>1 cup rice</li>
<li>1 cup yellow moong dal</li>
<li>3 cups buttermilk</li>
<li>3-4 green chillies finely chopped</li>
<li>3 Tbsp coriander chopped</li>
</ul>
<p> Follow the step to have <q> A traditional Gujarati savoury cake. It is made with a combinations of lentils, rice and buttermilk</q></p>
<p><strong>Steps:</strong></p>
<ol>
<li>Take butter milk Add salt, soda and flour, mix well,Keep it aside for 6-7 hours.</li>
<li>Grate bottle gourd and squeeze out excess water,add gourd,coriander,green chillies</li>
<li>Heat oil in a pan,urad & channa dals and seeds,Allow to splutter,pouin the batter and mix it thoroughly.</li>
<li>Check by inserting a skewer,which should come out clean. Slice into wedges and serve hot.</li>
</ol>
</article>
<article>
<h2 id="third">Dosa</h2>
<img src="https://cdn.vox-cdn.com/thumbor/oRMz04HKckdj5s4aPAImXQHJ1d0=/0x0:2808x1872/1200x800/filters:focal(1180x712:1628x1160)/cdn.vox-cdn.com/uploads/chorus_image/image/56417501/Dosa2.1504026967.jpg" alt= "dosa in plate for dinner with chatni" width=350>
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>3/4 cup Parboiled and 3/4 cup Regular Rice</li>
<li>1/2 cup Urad Dal and 1/2 tablespoon Chana Dal</li>
<li>1/4 teaspoon Fenugreek Seeds (methi dana)</li>
<li>Water as needed ,Salt to taste,Oil for shallow frying</li>
<li>3 Tbsp coriander chopped</li>
</ul>
<p> try it <q> All you need is love. But a little dosa doesn’t hurt.</q></p>
<p><strong>Steps:</strong></p>
<ol>
<li> The batter should be fluffy and not very thick. Transfer it to a large container</li>
<li> Take all the ingredients to prepare the dosa batter. Rice, urad dal and fenugreek seeds are the main ingredients.</li>
<li> Apply 1-teaspoon oil around the edges of dosa .</li>
<li> Cook until the bottom surface turns light brown and the edges start to come upward.
</li>
</ol>
</article>
<a href=#top > <img id="back-to-top" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSKESsqyheQZhgMM0UMtRe39dEkePwmEL0TPgTwMnpFTZfSLxJh" alt= "back to top image" width=30></a>
</body>
</html>
Maybe you just want to change
h2{display:inline-block;
clear: both;}
img{
clear:both;
}
to
img{
display:block;
}
and remove those <br> tags instead?
I don't see any float property in your CSS. clear: both only works with float. The issue you have is because of the display:inline-block; set on the h2, so delete it and everything should work properly. You don't need the clear: both:
#back-to-top {
position: fixed;
bottom: 20px;
right: 20px;
}
h1,
h2 {
background-color: black;
color: white;
}
h1 {
text-align: center;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recipe project - Module 1</title>
</head>
<body>
<h1 id="top">My favorite Recipes: </h1>
<nav>
<ul>
<li><a href=#first>Panipuri</a></li>
<li><a href=#second>Handvo</a></li>
<li><a href=#third>Dosa</a></li>
</ul>
</nav>
<article>
<h2 id="first">Panipuri</h2>
<img src= "https://qph.ec.quoracdn.net/main-qimg-14f6bc4a3b89ae33a33107a9b56b38e7" alt="delicious pani puri plate" width= 350 title="once you have it you will forget all the items">
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>Kothamir Pani</li>
<li>Dates Pani</li>
<li>Puri</li>
<li>Masala Ragda</li>
</ul>
<q>Have it and forget everthing</q>
<p><strong>Steps:</strong></p>
<ol>
<li>Make Masal Ragda</li>
<li>make Kothmir pani</li>
<li>make Dates pani</li>
<li>take Puri and start eating</li>
</ol>
</article>
<br>
<article>
<h2 id="second">Handvo</h2>
<img src="http://somethingscookingwithalpa.com/wp-content/uploads/2017/11/handvo-WEB.jpg" alt="handvo plate" width=350 title="handvo really teasty have it">
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>1 cup rice</li>
<li>1 cup yellow moong dal</li>
<li>3 cups buttermilk</li>
<li>3-4 green chillies finely chopped</li>
<li>3 Tbsp coriander chopped</li>
</ul>
<p> Follow the step to have <q> A traditional Gujarati savoury cake. It is made with a combinations of lentils, rice and buttermilk</q></p>
<p><strong>Steps:</strong></p>
<ol>
<li>Take butter milk Add salt, soda and flour, mix well,Keep it aside for 6-7 hours.</li>
<li>Grate bottle gourd and squeeze out excess water,add gourd,coriander,green chillies</li>
<li>Heat oil in a pan,urad & channa dals and seeds,Allow to splutter,pouin the batter and mix it thoroughly.</li>
<li>Check by inserting a skewer,which should come out clean. Slice into wedges and serve hot.</li>
</ol>
</article>
<article>
<h2 id="third">Dosa</h2>
<img src="https://cdn.vox-cdn.com/thumbor/oRMz04HKckdj5s4aPAImXQHJ1d0=/0x0:2808x1872/1200x800/filters:focal(1180x712:1628x1160)/cdn.vox-cdn.com/uploads/chorus_image/image/56417501/Dosa2.1504026967.jpg" alt="dosa in plate for dinner with chatni" width=350>
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>3/4 cup Parboiled and 3/4 cup Regular Rice</li>
<li>1/2 cup Urad Dal and 1/2 tablespoon Chana Dal</li>
<li>1/4 teaspoon Fenugreek Seeds (methi dana)</li>
<li>Water as needed ,Salt to taste,Oil for shallow frying</li>
<li>3 Tbsp coriander chopped</li>
</ul>
<p> try it <q> All you need is love. But a little dosa doesn’t hurt.</q></p>
<p><strong>Steps:</strong></p>
<ol>
<li> The batter should be fluffy and not very thick. Transfer it to a large container</li>
<li> Take all the ingredients to prepare the dosa batter. Rice, urad dal and fenugreek seeds are the main ingredients.</li>
<li> Apply 1-teaspoon oil around the edges of dosa .</li>
<li> Cook until the bottom surface turns light brown and the edges start to come upward.
</li>
</ol>
</article>
<a href=#top> <img id="back-to-top" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSKESsqyheQZhgMM0UMtRe39dEkePwmEL0TPgTwMnpFTZfSLxJh" alt="back to top image" width=30></a>
</body>
</html>
add width: 100%; to h2 tag
#back-to-top {
position: fixed;
bottom: 20px;
right: 20px;
}
h1, h2
{
background-color: black;
color: white;}
h1{
text-align: center;
}
h2{display:inline-block;
clear: both;
width: 100%;}
img{
clear:both;
}
<!doctype html>
<html lang= "en">
<head>
<meta charset= "UTF-8">
<title>Recipe project - Module 1</title>
</head>
<body>
<h1 id = "top">My favorite Recipes: </h1>
<nav>
<ul>
<li><a href=#first>Panipuri</a></li>
<li><a href=#second>Handvo</a></li>
<li><a href=#third>Dosa</a></li>
</ul>
</nav>
<article>
<h2 id="first">Panipuri</h2>
<img src= "https://qph.ec.quoracdn.net/main-qimg-14f6bc4a3b89ae33a33107a9b56b38e7" alt="delicious pani puri plate" width= 350 title="once you have it you will forget all the items">
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>Kothamir Pani</li>
<li>Dates Pani</li>
<li>Puri</li>
<li>Masala Ragda</li>
</ul>
<q>Have it and forget everthing</q>
<p><strong>Steps:</strong></p>
<ol>
<li>Make Masal Ragda</li>
<li>make Kothmir pani</li>
<li>make Dates pani</li>
<li>take Puri and start eating</li>
</ol></article>
<br>
<article>
<h2 id="second">Handvo</h2>
<img src="http://somethingscookingwithalpa.com/wp-content/uploads/2017/11/handvo-WEB.jpg" alt = "handvo plate" width=350 title="handvo really teasty have it">
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>1 cup rice</li>
<li>1 cup yellow moong dal</li>
<li>3 cups buttermilk</li>
<li>3-4 green chillies finely chopped</li>
<li>3 Tbsp coriander chopped</li>
</ul>
<p> Follow the step to have <q> A traditional Gujarati savoury cake. It is made with a combinations of lentils, rice and buttermilk</q></p>
<p><strong>Steps:</strong></p>
<ol>
<li>Take butter milk Add salt, soda and flour, mix well,Keep it aside for 6-7 hours.</li>
<li>Grate bottle gourd and squeeze out excess water,add gourd,coriander,green chillies</li>
<li>Heat oil in a pan,urad & channa dals and seeds,Allow to splutter,pouin the batter and mix it thoroughly.</li>
<li>Check by inserting a skewer,which should come out clean. Slice into wedges and serve hot.</li>
</ol>
</article>
<article>
<h2 id="third">Dosa</h2>
<img src="https://cdn.vox-cdn.com/thumbor/oRMz04HKckdj5s4aPAImXQHJ1d0=/0x0:2808x1872/1200x800/filters:focal(1180x712:1628x1160)/cdn.vox-cdn.com/uploads/chorus_image/image/56417501/Dosa2.1504026967.jpg" alt= "dosa in plate for dinner with chatni" width=350>
<br>
<br>
<span><strong>List of Ingredients:</strong></span>
<ul>
<li>3/4 cup Parboiled and 3/4 cup Regular Rice</li>
<li>1/2 cup Urad Dal and 1/2 tablespoon Chana Dal</li>
<li>1/4 teaspoon Fenugreek Seeds (methi dana)</li>
<li>Water as needed ,Salt to taste,Oil for shallow frying</li>
<li>3 Tbsp coriander chopped</li>
</ul>
<p> try it <q> All you need is love. But a little dosa doesn’t hurt.</q></p>
<p><strong>Steps:</strong></p>
<ol>
<li> The batter should be fluffy and not very thick. Transfer it to a large container</li>
<li> Take all the ingredients to prepare the dosa batter. Rice, urad dal and fenugreek seeds are the main ingredients.</li>
<li> Apply 1-teaspoon oil around the edges of dosa .</li>
<li> Cook until the bottom surface turns light brown and the edges start to come upward.
</li>
</ol>
</article>
<a href=#top > <img id="back-to-top" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSKESsqyheQZhgMM0UMtRe39dEkePwmEL0TPgTwMnpFTZfSLxJh" alt= "back to top image" width=30></a>
</body>
</html>
i tried to validate a .html file and received this error-
Error: Element ul not allowed as child of element ol in this context
<ol>
<li><span class="bold">Preheat Oven:</span> Preheat oven </li>
<li>To Mak</li>
<ul>
<li>Whisk together </li>
<li>Stir in water,.</li>
<li>Cook over</li>
<li>Stir in butter.</li>
<li>Place egg yolks</li>
<li>Whisk egg yolk . </li>
<li>Bring to a </li>
<li>Remove from heat. </li>
<li>Pour fill.</li>
</ul>
<li><span class="bold">Make Meringue:</span> bowl ...</li>
<ul>
<li> woamy.</li>
<li>Add sugar gradua. </li>
<li> sealing the edges at the crust.</li>
</ul>
<li>brown.</li>
</ol>
I cannot seems to figure out what I did wrong. Any suggestions?
You need to wrap the unordered list in list item tags, otherwise they are just floating around in the middle of no where:
<ol>
<li><span class="bold">Preheat Oven:</span> Preheat oven </li>
<li>To Mak</li>
<li>
<ul>
<li>Whisk together </li>
<li>Stir in water,.</li>
<li>Cook over</li>
<li>Stir in butter.</li>
<li>Place egg yolks</li>
<li>Whisk egg yolk . </li>
<li>Bring to a </li>
<li>Remove from heat. </li>
<li>Pour fill.</li>
</ul>
</li>
<li><span class="bold">Make Meringue:</span> bowl ...</li>
<li>
<ul>
<li> woamy.</li>
<li>Add sugar gradua. </li>
<li> sealing the edges at the crust.</li>
</ul>
</li>
<li>brown.</li>
</ol>
https://stackoverflow.com/a/15870503/8179067 i think the answer can be founded in this topic :)
"
This is because the content model for (and actually) is zero or more li elements
These two tags actually can't contain anything other than tags or nothing at all. If you have browsers will automatically close the tag before beginning the (well, the good ones).
try with this one :)
Here's my code:
<!DOCTYPE html>
<html>
<head><title>name</title></head>
<body background="bg.jpg">
<h1 align=center>About me</h1>
<center><img src="barons.jpg" height="300" width="450" vspace="20"/></center>
<h3>Basic Info</h3>
<ul type="circle">
<li>I love to play baseball</li>
<li>I go to - High School</li>
<li>My favorite type of music is -</li>
<li>I love writing computer programs</li>
</ul>
<h3>Educational Background</h3>
<ul type="circle">
<li>I attended -</li>
<li>I maintained a - GPA while I was there</li>
<li>I attended - School for 6th grade</li>
<li>I attended - school for 7th and 8th grade</li>
<li>I now attend - School</li>
</ul>
<h3>Favorite Sports Teams</h3>
<ul type="circle">
<li>-(Baseball)</li>
<li>-(Football)</li>
<li>-(Football and Baseball)</li>
<li>-(Football and Basketball)</li>
</ul>
</body>
</html>
I'm trying to have all three unordered lists and their headers be at the same height on the page as my image, but to the left of it. I tried <br clear="left"/> in many places, but it didn't work.
You'll need to wrap both the text and the image into one div that you can then center. eg.
<div style="margin:0 auto; width:500px">
<img src="xxx" style="float:right; width:200px;" />
<div style="width:300px float:left;">
Insert text here...
</div>
</div>
Obviously, you would use classes instead of inline style.
Check the jsbin over here http://jsbin.com/zatetu/1/edit
Check the output at http://jsbin.com/zatetu/1
HTML CODE
<!DOCTYPE html>
<html>
<head><title>Jeff Koppenhoefer</title></head>
<body background="bg.jpg">
<style type="text/css">
.floatDiv{
float:left;
margin:10px;
}
</style>
<h1 align=center>About me</h1>
<div class="floatDiv">
<img src="barons.jpg" height="300" width="450" vspace="20"/>
</div>
<div class="floatDiv">
<h3>Basic Info</h3>
<ul type="circle">
<li>I love to play baseball</li>
<li>I go to Hilliard Davidson High School</li>
<li>My favorite type of music is rap</li>
<li>I love writing computer programs</li>
</ul>
</div>
<div class="floatDiv">
<h3>Educational Background</h3>
<ul type="circle">
<li>I attended Cypress Christian School through 5th grade</li>
<li>I maintained a 4.0 GPA while I was there</li>
<li>I attended Tharp 6th Grade School for 6th grade</li>
<li>I attended Weaver Middle School for 7th and 8th grade</li>
<li>I now attend Hilliard Davidson High School</li>
</ul>
</div>
<div class="floatDiv">
<h3>Favorite Sports Teams</h3>
<ul type="circle">
<li>St. Louis Cardinals (Baseball)</li>
<li>Pittsburgh Steelers (Football)</li>
<li>Davidson Wildcats (Football and Baseball)</li>
<li>OSU Buckeyes (Football and Basketball)</li>
</ul>
</div>
</body>
</html>
You could use a table and adjust the pictures size and cell sizelike we learned in programming class. Hit me up if you're interested in some programming activities at school. You should know who I am.
<!DOCTYPE html>
<html>
<head><title>Jeff Koppenhoefer</title></head>
<body background="bg.jpg">
<h1 align=center>About me</h1>
<table>
<tr>
<td><h3>Basic Info</h3>
<ul type="circle">
<li>I love to play baseball</li>
<li>I go to Hilliard Davidson High School</li>
<li>My favorite type of music is rap</li>
<li>I love writing computer programs</li>
</ul>
</td>
<td><img src="barons.jpg"/></td>
</table>
<h3>Educational Background</h3>
<ul type="circle">
<li>I attended Cypress Christian School through 5th grade</li>
<li>I maintained a 4.0 GPA while I was there</li>
<li>I attended Tharp 6th Grade School for 6th grade</li>
<li>I attended Weaver Middle School for 7th and 8th grade</li>
<li>I now attend Hilliard Davidson High School</li>
</ul>
<h3>Favorite Sports Teams</h3>
<ul type="circle">
<li>St. Louis Cardinals (Baseball)</li>
<li>Pittsburgh Steelers (Football)</li>
<li>Davidson Wildcats (Football and Baseball)</li>
<li>OSU Buckeyes (Football and Basketball)</li>
</ul>
</body>
</html>