Tuesday, February 25, 2025
}
}
Responsive Text Editor
/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');
body {
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, #FF6B6B, #556270);
color: white;
text-align: center;
padding: 20px;
}
.editor-container {
background: rgba(255, 255, 255, 0.1);
padding: 20px;
border-radius: 10px;
max-width: 700px;
margin: auto;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
h2 {
margin-bottom: 10px;
}
.toolbar {
background: rgba(0, 0, 0, 0.2);
padding: 10px;
border-radius: 5px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
}
.toolbar button, .toolbar input, .toolbar select {
padding: 8px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
.toolbar button {
background: white;
color: black;
}
.toolbar input {
width: 40px;
height: 30px;
border: none;
cursor: pointer;
}
.toolbar select {
background: white;
color: black;
}
.toolbar button:hover {
background: #FF6B6B;
color: white;
}
.text-area {
min-height: 200px;
background: white;
color: black;
padding: 15px;
margin-top: 10px;
border-radius: 5px;
border: 1px solid #ccc;
overflow-y: auto;
text-align: left;
}
@media (max-width: 600px) {
.toolbar {
flex-direction: column;
}
.toolbar button {
width: 100%;
}
}
// Function to format text (bold, italic, underline, etc.)
function formatText(command) {
document.execCommand(command, false, null);
}
// Function to change font color
function changeColor(color) {
document.execCommand("foreColor", false, color);
}
// Function to change font size
function changeFontSize(size) {
document.execCommand("fontSize", false, size);
}
// Function to undo last action
function undo() {
document.execCommand("undo", false, null);
}
// Function to redo last undone action
function redo() {
document.execCommand("redo", false, null);
}
// Function to clear the text area
function clearText() {
document.getElementById("editor").innerHTML = "";
}
// Function to download text as .txt file
function downloadText() {
let text = document.getElementById("editor").innerText;
let blob = new Blob([text], { type: "text/plain" });
let anchor = document.createElement("a");
anchor.href = URL.createObjectURL(blob);
anchor.download = "text-editor-content.txt";
anchor.click();
}
}
}
Text to PDF Converter
/* General Styles */
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #ff9a9e, #fad0c4, #fad0c4, #ffdde1);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 0;
}
/* Container */
.container {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2);
max-width: 400px;
width: 100%;
}
/* Heading */
h1 {
color: #ff6b81;
font-size: 24px;
}
function generatePDF() {
const { jsPDF } = window.jspdf;
let doc = new jsPDF();
let text = document.getElementById("textInput").value;
if (text.trim() === "") {
alert("Please enter some text!");
return;
}
doc.setFont("helvetica", "bold");
doc.setFontSize(14);
doc.text("Converted Text to PDF", 10, 10);
doc.setFont("times", "normal");
doc.setFontSize(12);
doc.text(text, 10, 20, { maxWidth: 180 });
doc.save("converted.pdf");
}
/* Textarea */
textarea {
width: 100%;
height: 150px;
padding: 10px;
border: 2px solid #ff6b81;
border-radius: 5px;
resize: none;
font-size: 16px;
outline: none;
}
/* Button */
button {
background: #ff6b81;
color: white;
border: none;
padding: 10px 15px;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
margin-top: 10px;
transition: 0.3s;
}
button:hover {
background: #ff4757;
}
/* Responsive */
@media (max-width: 500px) {
.container {
width: 90%;
}
}
Text to PDF Converter
OPML to JSON Converter
Convert your OPML file to JSON with ease!
Subscribe to:
Posts (Atom)
} } Responsive Text Editor Responsive Text Editor B ...
